diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/types.py deleted file mode 100644 index 4633982a34d1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/authentication-oauth2/authentication/oauth2/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class InvalidAuth(TypedDict, total=False): - """InvalidAuth. - - :ivar error: Required. - :vartype error: str - """ - - error: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/types.py deleted file mode 100644 index 02f81f1cac29..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/types.py +++ /dev/null @@ -1,129 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class BaseModel(TypedDict, total=False): - """Used in internal operations, should be generated but not exported. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class InnerModel(TypedDict, total=False): - """Used in internal operations, should be generated but not exported. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class InternalDecoratorModelInInternal(TypedDict, total=False): - """Used in an internal operation, should be generated but not exported. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class NoDecoratorModelInInternal(TypedDict, total=False): - """Used in an internal operation, should be generated but not exported. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class NoDecoratorModelInPublic(TypedDict, total=False): - """Used in a public operation, should be generated and exported. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class OuterModel(BaseModel): - """Used in internal operations, should be generated but not exported. - - :ivar name: Required. - :vartype name: str - :ivar inner: Required. - :vartype inner: ~specs.azure.clientgenerator.core.access.models._models.InnerModel - """ - - inner: Required["InnerModel"] - """Required.""" - - -class PublicDecoratorModelInInternal(TypedDict, total=False): - """Used in an internal operation but with public decorator, should be generated and exported. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class PublicDecoratorModelInPublic(TypedDict, total=False): - """Used in a public operation, should be generated and exported. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class RealModel(TypedDict, total=False): - """Used in internal operations, should be generated but not exported. - - :ivar name: Required. - :vartype name: str - :ivar kind: Required. Default value is "real". - :vartype kind: str - """ - - name: Required[str] - """Required.""" - kind: Required[Literal["real"]] - """Required. Default value is \"real\".""" - - -class SharedModel(TypedDict, total=False): - """Used by both public and internal operation. It should be generated and exported. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -AbstractModel = Union[RealModel] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py index 61a72371cd42..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py @@ -8,45 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Type -import geojson -from geojson.geometry import Geometry -from .._utils.model_base import TYPE_HANDLER_REGISTRY - - -@TYPE_HANDLER_REGISTRY.register_serializer(geojson.Feature) -def feature_serializer(obj: geojson.Feature) -> dict: - """Serialize a geojson.Feature to a dict. - - :param obj: The geojson.Feature object to serialize. - :type obj: geojson.Feature - :return: The serialized feature as a dictionary. - :rtype: dict - """ - return { - "type": obj.type, - "geometry": {"type": obj.geometry.type, "coordinates": obj.geometry.coordinates}, - "properties": obj.properties, - "id": obj.id, - } - - -@TYPE_HANDLER_REGISTRY.register_deserializer(geojson.Feature) -def feature_deserializer(cls: Type[geojson.Feature], data: dict) -> geojson.Feature: - """Deserialize a dict to a geojson.Feature. - - :param data: The dictionary data to deserialize. - :type data: dict - :return: The deserialized geojson.Feature object. - :rtype: geojson.Feature - """ - return cls( - type=data.get("type"), - geometry=Geometry(type=data["geometry"].get("type"), coordinates=data["geometry"].get("coordinates")), - properties=data.get("properties"), - id=data.get("id"), - ) - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/types.py deleted file mode 100644 index fc51867ea321..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/types.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - -import geojson - - -class Geometry(TypedDict, total=False): - """Geometry. - - :ivar type: Required. - :vartype type: str - :ivar coordinates: Required. - :vartype coordinates: list[float] - """ - - type: Required[str] - """Required.""" - coordinates: Required[list[float]] - """Required.""" - - -class ModelWithFeatureProperty(TypedDict, total=False): - """ModelWithFeatureProperty. - - :ivar feature: Required. - :vartype feature: ~geojson.Feature - :ivar additional_property: Required. - :vartype additional_property: str - """ - - feature: Required[geojson.Feature] - """Required.""" - additionalProperty: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/types.py deleted file mode 100644 index bdd97d837d0a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/types.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class ModelWithDefaultValues(TypedDict, total=False): - """Model with client default values on properties. - - :ivar name: Name property with no default value. Required. - :vartype name: str - :ivar timeout: Timeout property with client default value of 30. - :vartype timeout: int - :ivar tier: Tier property with client default value of 'standard'. - :vartype tier: str - :ivar retry: Retry property with client default value of true. - :vartype retry: bool - """ - - name: Required[str] - """Name property with no default value. Required.""" - timeout: int - """Timeout property with client default value of 30.""" - tier: str - """Tier property with client default value of 'standard'.""" - retry: bool - """Retry property with client default value of true.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/types.py deleted file mode 100644 index c5f721afcb17..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-doc/specs/azure/clientgenerator/core/clientdoc/types.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Plant(TypedDict, total=False): - """A plant in the garden. This model is used to represent a plant in the client SDK. - - :ivar name: The name of the plant. Required. - :vartype name: str - :ivar species: The species of the plant. Required. - :vartype species: str - """ - - name: Required[str] - """The name of the plant. Required.""" - species: Required[str] - """The species of the plant. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/types.py deleted file mode 100644 index e21bdf2e9adb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/types.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing_extensions import Required, TypedDict - - -class BlobProperties(TypedDict, total=False): - """Properties of a blob. - - :ivar name: Required. - :vartype name: str - :ivar size: Required. - :vartype size: int - :ivar content_type: Required. - :vartype content_type: str - :ivar created_on: Required. - :vartype created_on: ~datetime.datetime - """ - - name: Required[str] - """Required.""" - size: Required[int] - """Required.""" - contentType: Required[str] - """Required.""" - createdOn: Required[datetime.datetime] - """Required.""" - - -class Input(TypedDict, total=False): - """Input. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class WithBodyRequest(TypedDict, total=False): - """WithBodyRequest. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/types.py deleted file mode 100644 index a555e5854a41..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/types.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing_extensions import Required, TypedDict - - -class BlobProperties(TypedDict, total=False): - """Properties of a blob. - - :ivar name: Required. - :vartype name: str - :ivar size: Required. - :vartype size: int - :ivar content_type: Required. - :vartype content_type: str - :ivar created_on: Required. - :vartype created_on: ~datetime.datetime - """ - - name: Required[str] - """Required.""" - size: Required[int] - """Required.""" - contentType: Required[str] - """Required.""" - createdOn: Required[datetime.datetime] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/types.py deleted file mode 100644 index a555e5854a41..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/types.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing_extensions import Required, TypedDict - - -class BlobProperties(TypedDict, total=False): - """Properties of a blob. - - :ivar name: Required. - :vartype name: str - :ivar size: Required. - :vartype size: int - :ivar content_type: Required. - :vartype content_type: str - :ivar created_on: Required. - :vartype created_on: ~datetime.datetime - """ - - name: Required[str] - """Required.""" - size: Required[int] - """Required.""" - contentType: Required[str] - """Required.""" - createdOn: Required[datetime.datetime] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/CHANGELOG.md deleted file mode 100644 index 628743d283a9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release History - -## 1.0.0b1 (1970-01-01) - -- Initial version diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/LICENSE b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/LICENSE deleted file mode 100644 index 63447fd8bbbf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/MANIFEST.in b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/MANIFEST.in deleted file mode 100644 index 8a97fb919767..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/MANIFEST.in +++ /dev/null @@ -1,9 +0,0 @@ -include *.md -include LICENSE -include specs/azure/clientgenerator/core/clientinitialization/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include specs/__init__.py -include specs/azure/__init__.py -include specs/azure/clientgenerator/__init__.py -include specs/azure/clientgenerator/core/__init__.py diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/apiview-properties.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/apiview-properties.json deleted file mode 100644 index bc22379471ff..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/apiview-properties.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "CrossLanguagePackageId": "Service", - "CrossLanguageDefinitionId": { - "specs.azure.clientgenerator.core.clientinitialization.models.BlobProperties": "Service.BlobProperties", - "specs.azure.clientgenerator.core.clientinitialization.models.Input": "Service.Input", - "specs.azure.clientgenerator.core.clientinitialization.models.WithBodyRequest": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.withBody.Request.anonymous", - "specs.azure.clientgenerator.core.clientinitialization.HeaderParamClient.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.aio.HeaderParamClient.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.HeaderParamClient.with_body": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", - "specs.azure.clientgenerator.core.clientinitialization.aio.HeaderParamClient.with_body": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", - "specs.azure.clientgenerator.core.clientinitialization.MultipleParamsClient.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.aio.MultipleParamsClient.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.MultipleParamsClient.with_body": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", - "specs.azure.clientgenerator.core.clientinitialization.aio.MultipleParamsClient.with_body": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", - "specs.azure.clientgenerator.core.clientinitialization.MixedParamsClient.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.aio.MixedParamsClient.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.MixedParamsClient.with_body": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", - "specs.azure.clientgenerator.core.clientinitialization.aio.MixedParamsClient.with_body": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", - "specs.azure.clientgenerator.core.clientinitialization.PathParamClient.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.aio.PathParamClient.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.PathParamClient.get_standalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", - "specs.azure.clientgenerator.core.clientinitialization.aio.PathParamClient.get_standalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", - "specs.azure.clientgenerator.core.clientinitialization.PathParamClient.delete_standalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", - "specs.azure.clientgenerator.core.clientinitialization.aio.PathParamClient.delete_standalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", - "specs.azure.clientgenerator.core.clientinitialization.ParamAliasClient.with_aliased_name": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", - "specs.azure.clientgenerator.core.clientinitialization.aio.ParamAliasClient.with_aliased_name": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", - "specs.azure.clientgenerator.core.clientinitialization.ParamAliasClient.with_original_name": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", - "specs.azure.clientgenerator.core.clientinitialization.aio.ParamAliasClient.with_original_name": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", - "specs.azure.clientgenerator.core.clientinitialization.operations.ChildClientOperations.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.aio.operations.ChildClientOperations.with_query": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", - "specs.azure.clientgenerator.core.clientinitialization.operations.ChildClientOperations.get_standalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", - "specs.azure.clientgenerator.core.clientinitialization.aio.operations.ChildClientOperations.get_standalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", - "specs.azure.clientgenerator.core.clientinitialization.operations.ChildClientOperations.delete_standalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone", - "specs.azure.clientgenerator.core.clientinitialization.aio.operations.ChildClientOperations.delete_standalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone" - } -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/dev_requirements.txt b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/dev_requirements.txt deleted file mode 100644 index 0e53b6a72db5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/dev_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --e ../../../eng/tools/azure-sdk-tools -../../core/azure-core -aiohttp \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/conftest.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/conftest.py deleted file mode 100644 index 7c1d5cc6a53a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/conftest.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import os -import pytest -from dotenv import load_dotenv -from devtools_testutils import ( - test_proxy, - add_general_regex_sanitizer, - add_body_key_sanitizer, - add_header_regex_sanitizer, -) - -load_dotenv() - - -# For security, please avoid record sensitive identity information in recordings -@pytest.fixture(scope="session", autouse=True) -def add_sanitizers(test_proxy): - headerparam_subscription_id = os.environ.get("HEADERPARAM_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - headerparam_tenant_id = os.environ.get("HEADERPARAM_TENANT_ID", "00000000-0000-0000-0000-000000000000") - headerparam_client_id = os.environ.get("HEADERPARAM_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - headerparam_client_secret = os.environ.get("HEADERPARAM_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=headerparam_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=headerparam_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=headerparam_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=headerparam_client_secret, value="00000000-0000-0000-0000-000000000000") - - multipleparams_subscription_id = os.environ.get( - "MULTIPLEPARAMS_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" - ) - multipleparams_tenant_id = os.environ.get("MULTIPLEPARAMS_TENANT_ID", "00000000-0000-0000-0000-000000000000") - multipleparams_client_id = os.environ.get("MULTIPLEPARAMS_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - multipleparams_client_secret = os.environ.get( - "MULTIPLEPARAMS_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" - ) - add_general_regex_sanitizer(regex=multipleparams_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=multipleparams_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=multipleparams_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=multipleparams_client_secret, value="00000000-0000-0000-0000-000000000000") - - mixedparams_subscription_id = os.environ.get("MIXEDPARAMS_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - mixedparams_tenant_id = os.environ.get("MIXEDPARAMS_TENANT_ID", "00000000-0000-0000-0000-000000000000") - mixedparams_client_id = os.environ.get("MIXEDPARAMS_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - mixedparams_client_secret = os.environ.get("MIXEDPARAMS_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=mixedparams_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=mixedparams_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=mixedparams_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=mixedparams_client_secret, value="00000000-0000-0000-0000-000000000000") - - pathparam_subscription_id = os.environ.get("PATHPARAM_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - pathparam_tenant_id = os.environ.get("PATHPARAM_TENANT_ID", "00000000-0000-0000-0000-000000000000") - pathparam_client_id = os.environ.get("PATHPARAM_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - pathparam_client_secret = os.environ.get("PATHPARAM_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=pathparam_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=pathparam_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=pathparam_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=pathparam_client_secret, value="00000000-0000-0000-0000-000000000000") - - paramalias_subscription_id = os.environ.get("PARAMALIAS_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - paramalias_tenant_id = os.environ.get("PARAMALIAS_TENANT_ID", "00000000-0000-0000-0000-000000000000") - paramalias_client_id = os.environ.get("PARAMALIAS_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - paramalias_client_secret = os.environ.get("PARAMALIAS_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=paramalias_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=paramalias_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=paramalias_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=paramalias_client_secret, value="00000000-0000-0000-0000-000000000000") - - parent_subscription_id = os.environ.get("PARENT_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - parent_tenant_id = os.environ.get("PARENT_TENANT_ID", "00000000-0000-0000-0000-000000000000") - parent_client_id = os.environ.get("PARENT_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - parent_client_secret = os.environ.get("PARENT_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=parent_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=parent_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=parent_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=parent_client_secret, value="00000000-0000-0000-0000-000000000000") - - add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") - add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_header_param.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_header_param.py deleted file mode 100644 index b31ec5cf5001..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_header_param.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import HeaderParamClientTestBase, HeaderParamPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestHeaderParam(HeaderParamClientTestBase): - @HeaderParamPreparer() - @recorded_by_proxy - def test_with_query(self, headerparam_endpoint): - client = self.create_client(endpoint=headerparam_endpoint) - response = client.with_query( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @HeaderParamPreparer() - @recorded_by_proxy - def test_with_body(self, headerparam_endpoint): - client = self.create_client(endpoint=headerparam_endpoint) - response = client.with_body( - body={"name": "str"}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_header_param_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_header_param_async.py deleted file mode 100644 index 787cb30d7bf4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_header_param_async.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import HeaderParamPreparer -from testpreparer_async import HeaderParamClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestHeaderParamAsync(HeaderParamClientTestBaseAsync): - @HeaderParamPreparer() - @recorded_by_proxy_async - async def test_with_query(self, headerparam_endpoint): - client = self.create_async_client(endpoint=headerparam_endpoint) - response = await client.with_query( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @HeaderParamPreparer() - @recorded_by_proxy_async - async def test_with_body(self, headerparam_endpoint): - client = self.create_async_client(endpoint=headerparam_endpoint) - response = await client.with_body( - body={"name": "str"}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_mixed_params.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_mixed_params.py deleted file mode 100644 index 396cff2001fb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_mixed_params.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import MixedParamsClientTestBase, MixedParamsPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMixedParams(MixedParamsClientTestBase): - @MixedParamsPreparer() - @recorded_by_proxy - def test_with_query(self, mixedparams_endpoint): - client = self.create_client(endpoint=mixedparams_endpoint) - response = client.with_query( - region="str", - id="str", - ) - - # please add some check logic here by yourself - # ... - - @MixedParamsPreparer() - @recorded_by_proxy - def test_with_body(self, mixedparams_endpoint): - client = self.create_client(endpoint=mixedparams_endpoint) - response = client.with_body( - body={"name": "str"}, - region="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_mixed_params_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_mixed_params_async.py deleted file mode 100644 index 9e962339c9e7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_mixed_params_async.py +++ /dev/null @@ -1,38 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import MixedParamsPreparer -from testpreparer_async import MixedParamsClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMixedParamsAsync(MixedParamsClientTestBaseAsync): - @MixedParamsPreparer() - @recorded_by_proxy_async - async def test_with_query(self, mixedparams_endpoint): - client = self.create_async_client(endpoint=mixedparams_endpoint) - response = await client.with_query( - region="str", - id="str", - ) - - # please add some check logic here by yourself - # ... - - @MixedParamsPreparer() - @recorded_by_proxy_async - async def test_with_body(self, mixedparams_endpoint): - client = self.create_async_client(endpoint=mixedparams_endpoint) - response = await client.with_body( - body={"name": "str"}, - region="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_multiple_params.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_multiple_params.py deleted file mode 100644 index 92b624f15bf9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_multiple_params.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import MultipleParamsClientTestBase, MultipleParamsPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMultipleParams(MultipleParamsClientTestBase): - @MultipleParamsPreparer() - @recorded_by_proxy - def test_with_query(self, multipleparams_endpoint): - client = self.create_client(endpoint=multipleparams_endpoint) - response = client.with_query( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @MultipleParamsPreparer() - @recorded_by_proxy - def test_with_body(self, multipleparams_endpoint): - client = self.create_client(endpoint=multipleparams_endpoint) - response = client.with_body( - body={"name": "str"}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_multiple_params_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_multiple_params_async.py deleted file mode 100644 index 14ef35169bc4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_multiple_params_async.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import MultipleParamsPreparer -from testpreparer_async import MultipleParamsClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMultipleParamsAsync(MultipleParamsClientTestBaseAsync): - @MultipleParamsPreparer() - @recorded_by_proxy_async - async def test_with_query(self, multipleparams_endpoint): - client = self.create_async_client(endpoint=multipleparams_endpoint) - response = await client.with_query( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @MultipleParamsPreparer() - @recorded_by_proxy_async - async def test_with_body(self, multipleparams_endpoint): - client = self.create_async_client(endpoint=multipleparams_endpoint) - response = await client.with_body( - body={"name": "str"}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_param_alias.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_param_alias.py deleted file mode 100644 index 8680bbb0cd5e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_param_alias.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import ParamAliasClientTestBase, ParamAliasPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestParamAlias(ParamAliasClientTestBase): - @ParamAliasPreparer() - @recorded_by_proxy - def test_with_aliased_name(self, paramalias_endpoint): - client = self.create_client(endpoint=paramalias_endpoint) - response = client.with_aliased_name() - - # please add some check logic here by yourself - # ... - - @ParamAliasPreparer() - @recorded_by_proxy - def test_with_original_name(self, paramalias_endpoint): - client = self.create_client(endpoint=paramalias_endpoint) - response = client.with_original_name() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_param_alias_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_param_alias_async.py deleted file mode 100644 index a9afaa016869..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_param_alias_async.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import ParamAliasPreparer -from testpreparer_async import ParamAliasClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestParamAliasAsync(ParamAliasClientTestBaseAsync): - @ParamAliasPreparer() - @recorded_by_proxy_async - async def test_with_aliased_name(self, paramalias_endpoint): - client = self.create_async_client(endpoint=paramalias_endpoint) - response = await client.with_aliased_name() - - # please add some check logic here by yourself - # ... - - @ParamAliasPreparer() - @recorded_by_proxy_async - async def test_with_original_name(self, paramalias_endpoint): - client = self.create_async_client(endpoint=paramalias_endpoint) - response = await client.with_original_name() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_parent_child_client_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_parent_child_client_operations.py deleted file mode 100644 index edef34518f2e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_parent_child_client_operations.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import ParentClientTestBase, ParentPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestParentChildClientOperations(ParentClientTestBase): - @ParentPreparer() - @recorded_by_proxy - def test_child_client_with_query(self, parent_endpoint): - client = self.create_client(endpoint=parent_endpoint) - response = client.child_client.with_query() - - # please add some check logic here by yourself - # ... - - @ParentPreparer() - @recorded_by_proxy - def test_child_client_get_standalone(self, parent_endpoint): - client = self.create_client(endpoint=parent_endpoint) - response = client.child_client.get_standalone() - - # please add some check logic here by yourself - # ... - - @ParentPreparer() - @recorded_by_proxy - def test_child_client_delete_standalone(self, parent_endpoint): - client = self.create_client(endpoint=parent_endpoint) - response = client.child_client.delete_standalone() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_parent_child_client_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_parent_child_client_operations_async.py deleted file mode 100644 index 60bf21dee4ec..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_parent_child_client_operations_async.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import ParentPreparer -from testpreparer_async import ParentClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestParentChildClientOperationsAsync(ParentClientTestBaseAsync): - @ParentPreparer() - @recorded_by_proxy_async - async def test_child_client_with_query(self, parent_endpoint): - client = self.create_async_client(endpoint=parent_endpoint) - response = await client.child_client.with_query() - - # please add some check logic here by yourself - # ... - - @ParentPreparer() - @recorded_by_proxy_async - async def test_child_client_get_standalone(self, parent_endpoint): - client = self.create_async_client(endpoint=parent_endpoint) - response = await client.child_client.get_standalone() - - # please add some check logic here by yourself - # ... - - @ParentPreparer() - @recorded_by_proxy_async - async def test_child_client_delete_standalone(self, parent_endpoint): - client = self.create_async_client(endpoint=parent_endpoint) - response = await client.child_client.delete_standalone() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_path_param.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_path_param.py deleted file mode 100644 index 66aa7f93817c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_path_param.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import PathParamClientTestBase, PathParamPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestPathParam(PathParamClientTestBase): - @PathParamPreparer() - @recorded_by_proxy - def test_with_query(self, pathparam_endpoint): - client = self.create_client(endpoint=pathparam_endpoint) - response = client.with_query() - - # please add some check logic here by yourself - # ... - - @PathParamPreparer() - @recorded_by_proxy - def test_get_standalone(self, pathparam_endpoint): - client = self.create_client(endpoint=pathparam_endpoint) - response = client.get_standalone() - - # please add some check logic here by yourself - # ... - - @PathParamPreparer() - @recorded_by_proxy - def test_delete_standalone(self, pathparam_endpoint): - client = self.create_client(endpoint=pathparam_endpoint) - response = client.delete_standalone() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_path_param_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_path_param_async.py deleted file mode 100644 index 43c3d4ebed88..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/test_path_param_async.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import PathParamPreparer -from testpreparer_async import PathParamClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestPathParamAsync(PathParamClientTestBaseAsync): - @PathParamPreparer() - @recorded_by_proxy_async - async def test_with_query(self, pathparam_endpoint): - client = self.create_async_client(endpoint=pathparam_endpoint) - response = await client.with_query() - - # please add some check logic here by yourself - # ... - - @PathParamPreparer() - @recorded_by_proxy_async - async def test_get_standalone(self, pathparam_endpoint): - client = self.create_async_client(endpoint=pathparam_endpoint) - response = await client.get_standalone() - - # please add some check logic here by yourself - # ... - - @PathParamPreparer() - @recorded_by_proxy_async - async def test_delete_standalone(self, pathparam_endpoint): - client = self.create_async_client(endpoint=pathparam_endpoint) - response = await client.delete_standalone() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/testpreparer.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/testpreparer.py deleted file mode 100644 index dc2403a0d5a7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/testpreparer.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer -import functools -from specs.azure.clientgenerator.core.clientinitialization import ( - HeaderParamClient, - MixedParamsClient, - MultipleParamsClient, - ParamAliasClient, - ParentClient, - PathParamClient, -) - - -class HeaderParamClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(HeaderParamClient) - return self.create_client_from_credential( - HeaderParamClient, - credential=credential, - endpoint=endpoint, - ) - - -HeaderParamPreparer = functools.partial( - PowerShellPreparer, "headerparam", headerparam_endpoint="https://fake_headerparam_endpoint.com" -) - - -class MultipleParamsClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(MultipleParamsClient) - return self.create_client_from_credential( - MultipleParamsClient, - credential=credential, - endpoint=endpoint, - ) - - -MultipleParamsPreparer = functools.partial( - PowerShellPreparer, "multipleparams", multipleparams_endpoint="https://fake_multipleparams_endpoint.com" -) - - -class MixedParamsClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(MixedParamsClient) - return self.create_client_from_credential( - MixedParamsClient, - credential=credential, - endpoint=endpoint, - ) - - -MixedParamsPreparer = functools.partial( - PowerShellPreparer, "mixedparams", mixedparams_endpoint="https://fake_mixedparams_endpoint.com" -) - - -class PathParamClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(PathParamClient) - return self.create_client_from_credential( - PathParamClient, - credential=credential, - endpoint=endpoint, - ) - - -PathParamPreparer = functools.partial( - PowerShellPreparer, "pathparam", pathparam_endpoint="https://fake_pathparam_endpoint.com" -) - - -class ParamAliasClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(ParamAliasClient) - return self.create_client_from_credential( - ParamAliasClient, - credential=credential, - endpoint=endpoint, - ) - - -ParamAliasPreparer = functools.partial( - PowerShellPreparer, "paramalias", paramalias_endpoint="https://fake_paramalias_endpoint.com" -) - - -class ParentClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(ParentClient) - return self.create_client_from_credential( - ParentClient, - credential=credential, - endpoint=endpoint, - ) - - -ParentPreparer = functools.partial(PowerShellPreparer, "parent", parent_endpoint="https://fake_parent_endpoint.com") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/testpreparer_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/testpreparer_async.py deleted file mode 100644 index 2c374ca8de23..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/generated_tests/testpreparer_async.py +++ /dev/null @@ -1,82 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase -from specs.azure.clientgenerator.core.clientinitialization.aio import ( - HeaderParamClient, - MixedParamsClient, - MultipleParamsClient, - ParamAliasClient, - ParentClient, - PathParamClient, -) - - -class HeaderParamClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(HeaderParamClient, is_async=True) - return self.create_client_from_credential( - HeaderParamClient, - credential=credential, - endpoint=endpoint, - ) - - -class MultipleParamsClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(MultipleParamsClient, is_async=True) - return self.create_client_from_credential( - MultipleParamsClient, - credential=credential, - endpoint=endpoint, - ) - - -class MixedParamsClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(MixedParamsClient, is_async=True) - return self.create_client_from_credential( - MixedParamsClient, - credential=credential, - endpoint=endpoint, - ) - - -class PathParamClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(PathParamClient, is_async=True) - return self.create_client_from_credential( - PathParamClient, - credential=credential, - endpoint=endpoint, - ) - - -class ParamAliasClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(ParamAliasClient, is_async=True) - return self.create_client_from_credential( - ParamAliasClient, - credential=credential, - endpoint=endpoint, - ) - - -class ParentClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(ParentClient, is_async=True) - return self.create_client_from_credential( - ParentClient, - credential=credential, - endpoint=endpoint, - ) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/pyproject.toml b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/pyproject.toml deleted file mode 100644 index 58b5e49608a7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/pyproject.toml +++ /dev/null @@ -1,63 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -[build-system] -requires = ["setuptools>=77.0.3", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "specs-azure-clientgenerator-core-clientinitialization" -authors = [ - { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, -] -description = "Microsoft Corporation Azure Specs Azure Clientgenerator Core Clientinitialization Client Library for Python" -license = "MIT" -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", -] -requires-python = ">=3.9" -keywords = ["azure", "azure sdk"] - -dependencies = [ - "isodate>=0.6.1", - "azure-core>=1.37.0", - "typing-extensions>=4.6.0", -] -dynamic = [ -"version", "readme" -] - -[project.urls] -repository = "https://github.com/Azure/azure-sdk-for-python" - -[tool.setuptools.dynamic] -version = {attr = "specs.azure.clientgenerator.core.clientinitialization._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} - -[tool.setuptools.packages.find] -exclude = [ - "tests*", - "generated_tests*", - "samples*", - "generated_samples*", - "doc*", - "specs", - "specs.azure", - "specs.azure.clientgenerator", - "specs.azure.clientgenerator.core", -] - -[tool.setuptools.package-data] -pytyped = ["py.typed"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/__init__.py deleted file mode 100644 index 979b2e24d000..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import HeaderParamClient # type: ignore -from ._client import MultipleParamsClient # type: ignore -from ._client import MixedParamsClient # type: ignore -from ._client import PathParamClient # type: ignore -from ._client import ParamAliasClient # type: ignore -from ._client import ParentClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "HeaderParamClient", - "MultipleParamsClient", - "MixedParamsClient", - "PathParamClient", - "ParamAliasClient", - "ParentClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_client.py deleted file mode 100644 index 7223ce139dca..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_client.py +++ /dev/null @@ -1,495 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any -from typing_extensions import Self - -from azure.core import PipelineClient -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse - -from ._configuration import ( - HeaderParamClientConfiguration, - MixedParamsClientConfiguration, - MultipleParamsClientConfiguration, - ParamAliasClientConfiguration, - ParentClientConfiguration, - PathParamClientConfiguration, -) -from ._utils.serialization import Deserializer, Serializer -from .operations import ( - ChildClientOperations, - _HeaderParamClientOperationsMixin, - _MixedParamsClientOperationsMixin, - _MultipleParamsClientOperationsMixin, - _ParamAliasClientOperationsMixin, - _PathParamClientOperationsMixin, -) - - -class HeaderParamClient(_HeaderParamClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Client for testing header parameter moved to client level. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = HeaderParamClientConfiguration(name=name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) - - -class MultipleParamsClient(_MultipleParamsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """MultipleParamsClient. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :param region: The region to use for all operations. This parameter is used as a query - parameter. Required. - :type region: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, name: str, region: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = MultipleParamsClientConfiguration(name=name, region=region, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) - - -class MixedParamsClient(_MixedParamsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """MixedParamsClient. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = MixedParamsClientConfiguration(name=name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) - - -class PathParamClient(_PathParamClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """PathParamClient. - - :param blob_name: The name of the blob. This parameter is used as a path parameter in all - operations. Required. - :type blob_name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, blob_name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = PathParamClientConfiguration(blob_name=blob_name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) - - -class ParamAliasClient(_ParamAliasClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """ParamAliasClient. - - :param blob_name: Blob name for the client. Required. - :type blob_name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, blob_name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = ParamAliasClientConfiguration(blob_name=blob_name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) - - -class ParentClient: # pylint: disable=client-accepts-api-version-keyword - """ParentClient. - - :ivar child_client: ChildClientOperations operations - :vartype child_client: - specs.azure.clientgenerator.core.clientinitialization.operations.ChildClientOperations - :param blob_name: The name of the blob. This parameter is used as a path parameter in all - operations. Required. - :type blob_name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, blob_name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = ParentClientConfiguration(blob_name=blob_name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - self.child_client = ChildClientOperations(self._client, self._config, self._serialize, self._deserialize) - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_configuration.py deleted file mode 100644 index 56d0d7a38f2c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_configuration.py +++ /dev/null @@ -1,228 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from ._version import VERSION - - -class HeaderParamClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for HeaderParamClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if name is None: - raise ValueError("Parameter 'name' must not be None.") - - self.name = name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class MultipleParamsClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for MultipleParamsClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :param region: The region to use for all operations. This parameter is used as a query - parameter. Required. - :type region: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, name: str, region: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if name is None: - raise ValueError("Parameter 'name' must not be None.") - if region is None: - raise ValueError("Parameter 'region' must not be None.") - - self.name = name - self.region = region - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class MixedParamsClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for MixedParamsClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if name is None: - raise ValueError("Parameter 'name' must not be None.") - - self.name = name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class PathParamClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for PathParamClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param blob_name: The name of the blob. This parameter is used as a path parameter in all - operations. Required. - :type blob_name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, blob_name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if blob_name is None: - raise ValueError("Parameter 'blob_name' must not be None.") - - self.blob_name = blob_name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class ParamAliasClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ParamAliasClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param blob_name: Blob name for the client. Required. - :type blob_name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, blob_name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if blob_name is None: - raise ValueError("Parameter 'blob_name' must not be None.") - - self.blob_name = blob_name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class ParentClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ParentClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param blob_name: The name of the blob. This parameter is used as a path parameter in all - operations. Required. - :type blob_name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, blob_name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if blob_name is None: - raise ValueError("Parameter 'blob_name' must not be None.") - - self.blob_name = blob_name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_patch.py deleted file mode 100644 index 8bcb627aa475..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/__init__.py deleted file mode 100644 index 8026245c2abc..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/model_base.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/model_base.py deleted file mode 100644 index c402af2afc63..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/model_base.py +++ /dev/null @@ -1,1337 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=protected-access, broad-except - -import copy -import calendar -import decimal -import functools -import sys -import logging -import base64 -import re -import typing -import enum -import email.utils -from datetime import datetime, date, time, timedelta, timezone -from json import JSONEncoder -import xml.etree.ElementTree as ET -from collections.abc import MutableMapping -from typing_extensions import Self -import isodate -from azure.core.exceptions import DeserializationError -from azure.core import CaseInsensitiveEnumMeta -from azure.core.pipeline import PipelineResponse -from azure.core.serialization import _Null -from azure.core.rest import HttpResponse - -_LOGGER = logging.getLogger(__name__) - -__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] - -TZ_UTC = timezone.utc -_T = typing.TypeVar("_T") -_NONE_TYPE = type(None) - - -def _timedelta_as_isostr(td: timedelta) -> str: - """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' - - Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython - - :param timedelta td: The timedelta to convert - :rtype: str - :return: ISO8601 version of this timedelta - """ - - # Split seconds to larger units - seconds = td.total_seconds() - minutes, seconds = divmod(seconds, 60) - hours, minutes = divmod(minutes, 60) - days, hours = divmod(hours, 24) - - days, hours, minutes = list(map(int, (days, hours, minutes))) - seconds = round(seconds, 6) - - # Build date - date_str = "" - if days: - date_str = "%sD" % days - - if hours or minutes or seconds: - # Build time - time_str = "T" - - # Hours - bigger_exists = date_str or hours - if bigger_exists: - time_str += "{:02}H".format(hours) - - # Minutes - bigger_exists = bigger_exists or minutes - if bigger_exists: - time_str += "{:02}M".format(minutes) - - # Seconds - try: - if seconds.is_integer(): - seconds_string = "{:02}".format(int(seconds)) - else: - # 9 chars long w/ leading 0, 6 digits after decimal - seconds_string = "%09.6f" % seconds - # Remove trailing zeros - seconds_string = seconds_string.rstrip("0") - except AttributeError: # int.is_integer() raises - seconds_string = "{:02}".format(seconds) - - time_str += "{}S".format(seconds_string) - else: - time_str = "" - - return "P" + date_str + time_str - - -def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: - encoded = base64.b64encode(o).decode() - if format == "base64url": - return encoded.strip("=").replace("+", "-").replace("/", "_") - return encoded - - -def _serialize_datetime(o, format: typing.Optional[str] = None): - if hasattr(o, "year") and hasattr(o, "hour"): - if format == "rfc7231": - return email.utils.format_datetime(o, usegmt=True) - if format == "unix-timestamp": - return int(calendar.timegm(o.utctimetuple())) - - # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) - if not o.tzinfo: - iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() - else: - iso_formatted = o.astimezone(TZ_UTC).isoformat() - # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) - return iso_formatted.replace("+00:00", "Z") - # Next try datetime.date or datetime.time - return o.isoformat() - - -def _is_readonly(p): - try: - return p._visibility == ["read"] - except AttributeError: - return False - - -class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" - - def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): - super().__init__(*args, **kwargs) - self.exclude_readonly = exclude_readonly - self.format = format - - def default(self, o): # pylint: disable=too-many-return-statements - if _is_model(o): - if self.exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - return {k: v for k, v in o.items() if k not in readonly_props} - return dict(o.items()) - try: - return super(SdkJSONEncoder, self).default(o) - except TypeError: - if isinstance(o, _Null): - return None - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, self.format) - try: - # First try datetime.datetime - return _serialize_datetime(o, self.format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return super(SdkJSONEncoder, self).default(o) - - -_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") -_VALID_RFC7231 = re.compile( - r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" - r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" -) - -_ARRAY_ENCODE_MAPPING = { - "pipeDelimited": "|", - "spaceDelimited": " ", - "commaDelimited": ",", - "newlineDelimited": "\n", -} - - -def _deserialize_array_encoded(delimit: str, attr): - if isinstance(attr, str): - if attr == "": - return [] - return attr.split(delimit) - return attr - - -def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - attr = attr.upper() - match = _VALID_DATE.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - return date_obj # type: ignore[no-any-return] - - -def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize RFC7231 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - match = _VALID_RFC7231.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - return email.utils.parsedate_to_datetime(attr) - - -def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: - """Deserialize unix timestamp into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - return datetime.fromtimestamp(attr, TZ_UTC) - - -def _deserialize_date(attr: typing.Union[str, date]) -> date: - """Deserialize ISO-8601 formatted string into Date object. - :param str attr: response string to be deserialized. - :rtype: date - :returns: The date object from that input - """ - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - if isinstance(attr, date): - return attr - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore - - -def _deserialize_time(attr: typing.Union[str, time]) -> time: - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :returns: The time object from that input - """ - if isinstance(attr, time): - return attr - return isodate.parse_time(attr) # type: ignore[no-any-return] - - -def _deserialize_bytes(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - return bytes(base64.b64decode(attr)) - - -def _deserialize_bytes_base64(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return bytes(base64.b64decode(encoded)) - - -def _deserialize_duration(attr): - if isinstance(attr, timedelta): - return attr - return isodate.parse_duration(attr) - - -def _deserialize_decimal(attr): - if isinstance(attr, decimal.Decimal): - return attr - return decimal.Decimal(str(attr)) - - -def _deserialize_int_as_str(attr): - if isinstance(attr, int): - return attr - return int(attr) - - -_DESERIALIZE_MAPPING = { - datetime: _deserialize_datetime, - date: _deserialize_date, - time: _deserialize_time, - bytes: _deserialize_bytes, - bytearray: _deserialize_bytes, - timedelta: _deserialize_duration, - typing.Any: lambda x: x, - decimal.Decimal: _deserialize_decimal, -} - -_DESERIALIZE_MAPPING_WITHFORMAT = { - "rfc3339": _deserialize_datetime, - "rfc7231": _deserialize_datetime_rfc7231, - "unix-timestamp": _deserialize_datetime_unix_timestamp, - "base64": _deserialize_bytes, - "base64url": _deserialize_bytes_base64, -} - - -def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): - if annotation is int and rf and rf._format == "str": - return _deserialize_int_as_str - if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: - return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) - if rf and rf._format: - return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) - return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore - - -def _get_type_alias_type(module_name: str, alias_name: str): - types = { - k: v - for k, v in sys.modules[module_name].__dict__.items() - if isinstance(v, typing._GenericAlias) # type: ignore - } - if alias_name not in types: - return alias_name - return types[alias_name] - - -def _get_model(module_name: str, model_name: str): - models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} - module_end = module_name.rsplit(".", 1)[0] - models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) - if isinstance(model_name, str): - model_name = model_name.split(".")[-1] - if model_name not in models: - return model_name - return models[model_name] - - -_UNSET = object() - - -class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: dict[str, typing.Any]) -> None: - self._data = data - - def __contains__(self, key: typing.Any) -> bool: - return key in self._data - - def __getitem__(self, key: str) -> typing.Any: - # If this key has been deserialized (for mutable types), we need to handle serialization - if hasattr(self, "_attr_to_rest_field"): - cache_attr = f"_deserialized_{key}" - if hasattr(self, cache_attr): - rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) - if rf: - value = self._data.get(key) - if isinstance(value, (dict, list, set)): - # For mutable types, serialize and return - # But also update _data with serialized form and clear flag - # so mutations via this returned value affect _data - serialized = _serialize(value, rf._format) - # If serialized form is same type (no transformation needed), - # return _data directly so mutations work - if isinstance(serialized, type(value)) and serialized == value: - return self._data.get(key) - # Otherwise return serialized copy and clear flag - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - # Store serialized form back - self._data[key] = serialized - return serialized - return self._data.__getitem__(key) - - def __setitem__(self, key: str, value: typing.Any) -> None: - # Clear any cached deserialized value when setting through dictionary access - cache_attr = f"_deserialized_{key}" - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - self._data.__setitem__(key, value) - - def __delitem__(self, key: str) -> None: - self._data.__delitem__(key) - - def __iter__(self) -> typing.Iterator[typing.Any]: - return self._data.__iter__() - - def __len__(self) -> int: - return self._data.__len__() - - def __ne__(self, other: typing.Any) -> bool: - return not self.__eq__(other) - - def keys(self) -> typing.KeysView[str]: - """ - :returns: a set-like object providing a view on D's keys - :rtype: ~typing.KeysView - """ - return self._data.keys() - - def values(self) -> typing.ValuesView[typing.Any]: - """ - :returns: an object providing a view on D's values - :rtype: ~typing.ValuesView - """ - return self._data.values() - - def items(self) -> typing.ItemsView[str, typing.Any]: - """ - :returns: set-like object providing a view on D's items - :rtype: ~typing.ItemsView - """ - return self._data.items() - - def get(self, key: str, default: typing.Any = None) -> typing.Any: - """ - Get the value for key if key is in the dictionary, else default. - :param str key: The key to look up. - :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. - :rtype: any - """ - try: - return self[key] - except KeyError: - return default - - @typing.overload - def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ - - @typing.overload - def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs - - @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Removes specified key and return the corresponding value. - :param str key: The key to pop. - :param any default: The value to return if key is not in the dictionary - :returns: The value corresponding to the key. - :rtype: any - :raises KeyError: If key is not found and default is not given. - """ - if default is _UNSET: - return self._data.pop(key) - return self._data.pop(key, default) - - def popitem(self) -> tuple[str, typing.Any]: - """ - Removes and returns some (key, value) pair - :returns: The (key, value) pair. - :rtype: tuple - :raises KeyError: if D is empty. - """ - return self._data.popitem() - - def clear(self) -> None: - """ - Remove all items from D. - """ - self._data.clear() - - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ - """ - Updates D from mapping/iterable E and F. - :param any args: Either a mapping object or an iterable of key-value pairs. - """ - self._data.update(*args, **kwargs) - - @typing.overload - def setdefault(self, key: str, default: None = None) -> None: ... - - @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Same as calling D.get(k, d), and setting D[k]=d if k not found - :param str key: The key to look up. - :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. - :rtype: any - """ - if default is _UNSET: - return self._data.setdefault(key) - return self._data.setdefault(key, default) - - def __eq__(self, other: typing.Any) -> bool: - try: - other_model = self.__class__(other) - except Exception: - return False - return self._data == other_model._data - - def __repr__(self) -> str: - return str(self._data) - - -def _is_model(obj: typing.Any) -> bool: - return getattr(obj, "_is_model", False) - - -def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements - if isinstance(o, list): - if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): - return _ARRAY_ENCODE_MAPPING[format].join(o) - return [_serialize(x, format) for x in o] - if isinstance(o, dict): - return {k: _serialize(v, format) for k, v in o.items()} - if isinstance(o, set): - return {_serialize(x, format) for x in o} - if isinstance(o, tuple): - return tuple(_serialize(x, format) for x in o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, format) - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, enum.Enum): - return o.value - if isinstance(o, int): - if format == "str": - return str(o) - return o - try: - # First try datetime.datetime - return _serialize_datetime(o, format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return o - - -def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: - try: - return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) - except StopIteration: - return None - - -def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: - if not rf: - return _serialize(value, None) - if rf._is_multipart_file_input: - return value - if rf._is_model: - return _deserialize(rf._type, value) - if isinstance(value, ET.Element): - value = _deserialize(rf._type, value) - return _serialize(value, rf._format) - - -class Model(_MyMutableMapping): - _is_model = True - # label whether current class's _attr_to_rest_field has been calculated - # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: set[str] = set() - - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: - class_name = self.__class__.__name__ - if len(args) > 1: - raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } - if args: # pylint: disable=too-many-nested-blocks - if isinstance(args[0], ET.Element): - existed_attr_keys = [] - model_meta = getattr(self, "_xml", {}) - - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - if prop_meta.get("itemsName"): - xml_name = prop_meta.get("itemsName") - xml_ns = prop_meta.get("itemNs") - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = args[0].findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) - continue - - # text element is primitive type - if prop_meta.get("text", False): - if args[0].text is not None: - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = args[0].find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in args[0]: - if e.tag not in existed_attr_keys: - dict_to_pass[e.tag] = _convert_element(e) - else: - dict_to_pass.update( - {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} - ) - else: - non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] - if non_attr_kwargs: - # actual type errors only throw the first wrong keyword arg they see, so following that. - raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") - dict_to_pass.update( - { - self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) - for k, v in kwargs.items() - if v is not None - } - ) - super().__init__(dict_to_pass) - - def copy(self) -> "Model": - return Model(self.__dict__) - - 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' - mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property - k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") - } - annotations = { - k: v - for mro_class in mros - 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__ - if not rf._type: - rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) - if not rf._rest_name_input: - rf._rest_name_input = attr - cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) - cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - - return super().__new__(cls) - - def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: - for base in cls.__bases__: - if hasattr(base, "__mapping__"): - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore - - @classmethod - def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: - for v in cls.__dict__.values(): - if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: - return v - return None - - @classmethod - def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): - return cls(data) - discriminator = cls._get_discriminator(exist_discriminators) - if discriminator is None: - return cls(data) - exist_discriminators.append(discriminator._rest_name) - if isinstance(data, ET.Element): - model_meta = getattr(cls, "_xml", {}) - prop_meta = getattr(discriminator, "_xml", {}) - xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - if data.get(xml_name) is not None: - discriminator_value = data.get(xml_name) - else: - 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 - return mapped_cls._deserialize(data, exist_discriminators) - - def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: - """Return a dict that can be turned into json using json.dump. - - :keyword bool exclude_readonly: Whether to remove the readonly properties. - :returns: A dict JSON compatible object - :rtype: dict - """ - - result = {} - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] - for k, v in self.items(): - if exclude_readonly and k in readonly_props: # pyright: ignore - continue - is_multipart_file_input = False - try: - is_multipart_file_input = next( - rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k - )._is_multipart_file_input - except StopIteration: - pass - result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) - return result - - @staticmethod - def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: - if v is None or isinstance(v, _Null): - return None - if isinstance(v, (list, tuple, set)): - return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) - if isinstance(v, dict): - return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} - return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v - - -def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - - -def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - -def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - - -def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj: dict[typing.Any, typing.Any], -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = {child.tag: child for child in obj} - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - - -def _deserialize_multiple_sequence( - entry_deserializers: list[typing.Optional[typing.Callable]], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) - - -def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: - return ( - isinstance(deserializer, functools.partial) - and isinstance(deserializer.args[0], functools.partial) - and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable - ) - - -def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = list(obj) - - # encoded string may be deserialized to sequence - if isinstance(obj, str) and isinstance(deserializer, functools.partial): - # for list[str] - if _is_array_encoded_deserializer(deserializer): - return deserializer(obj) - - # for list[Union[...]] - if isinstance(deserializer.args[0], list): - for sub_deserializer in deserializer.args[0]: - if _is_array_encoded_deserializer(sub_deserializer): - return sub_deserializer(obj) - - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - -def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: - return sorted( - types, - key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), - ) - - -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches - annotation: typing.Any, - module: typing.Optional[str], - rf: typing.Optional["_RestField"] = None, -) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - if not annotation: - return None - - # is it a type alias? - if isinstance(annotation, str): - if module is not None: - annotation = _get_type_alias_type(module, annotation) - - # is it a forward ref / in quotes? - if isinstance(annotation, (str, typing.ForwardRef)): - try: - model_name = annotation.__forward_arg__ # type: ignore - except AttributeError: - model_name = annotation - if module is not None: - annotation = _get_model(module, model_name) # type: ignore - - try: - if module and _is_model(annotation): - if rf: - rf._is_model = True - - return functools.partial(_deserialize_model, annotation) # pyright: ignore - except Exception: - pass - - # is it a literal? - try: - if annotation.__origin__ is typing.Literal: # pyright: ignore - return None - except AttributeError: - pass - - # is it optional? - try: - if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore - if len(annotation.__args__) <= 2: # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) - # the type is Optional[Union[...]], we need to remove the None type from the Union - annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore - return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) - except AttributeError: - pass - - # is it union? - if getattr(annotation, "__origin__", None) is typing.Union: - # initial ordering is we make `string` the last deserialization option, because it is often them most generic - deserializers = [ - _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in _sorted_annotations(annotation.__args__) # pyright: ignore - ] - - return functools.partial(_deserialize_with_union, deserializers) - - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() == "dict": - value_deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[1], module, rf # pyright: ignore - ) - - return functools.partial( - _deserialize_dict, - value_deserializer, - module, - ) - except (AttributeError, IndexError): - pass - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: - if len(annotation.__args__) > 1: # pyright: ignore - entry_deserializers = [ - _get_deserialize_callable_from_annotation(dt, module, rf) - for dt in annotation.__args__ # pyright: ignore - ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) - deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[0], module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_sequence, deserializer, module) - except (TypeError, IndexError, AttributeError, SyntaxError): - pass - - def _deserialize_default( - deserializer, - obj, - ): - if obj is None: - return obj - try: - return _deserialize_with_callable(deserializer, obj) - except Exception: - pass - return obj - - if get_deserializer(annotation, rf): - return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) - - return functools.partial(_deserialize_default, annotation) - - -def _deserialize_with_callable( - deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], - value: typing.Any, -): # pylint: disable=too-many-return-statements - try: - if value is None or isinstance(value, _Null): - return None - if isinstance(value, ET.Element): - if deserializer is str: - return value.text or "" - if deserializer is int: - return int(value.text) if value.text else None - if deserializer is float: - return float(value.text) if value.text else None - if deserializer is bool: - return value.text == "true" if value.text else None - if deserializer is None: - return value - if deserializer in [int, float, bool]: - return deserializer(value) - if isinstance(deserializer, CaseInsensitiveEnumMeta): - try: - return deserializer(value) - except ValueError: - # for unknown value, return raw value - return value - if isinstance(deserializer, type) and issubclass(deserializer, Model): - return deserializer._deserialize(value, []) - return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) - except Exception as e: - raise DeserializationError() from e - - -def _deserialize( - deserializer: typing.Any, - value: typing.Any, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - if isinstance(value, PipelineResponse): - value = value.http_response.json() - if rf is None and format: - rf = _RestField(format=format) - if not isinstance(deserializer, functools.partial): - deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) - return _deserialize_with_callable(deserializer, value) - - -def _failsafe_deserialize( - deserializer: typing.Any, - response: HttpResponse, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - try: - return _deserialize(deserializer, response.json(), module, rf, format) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -def _failsafe_deserialize_xml( - deserializer: typing.Any, - response: HttpResponse, -) -> typing.Any: - try: - return _deserialize_xml(deserializer, response.text()) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -class _RestField: - def __init__( - self, - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - is_discriminator: bool = False, - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - ): - self._type = type - self._rest_name_input = name - self._module: typing.Optional[str] = None - self._is_discriminator = is_discriminator - self._visibility = visibility - self._is_model = False - self._default = default - self._format = format - self._is_multipart_file_input = is_multipart_file_input - self._xml = xml if xml is not None else {} - - @property - def _class_type(self) -> typing.Any: - result = getattr(self._type, "args", [None])[0] - # type may be wrapped by nested functools.partial so we need to check for that - if isinstance(result, functools.partial): - return getattr(result, "args", [None])[0] - return result - - @property - def _rest_name(self) -> str: - if self._rest_name_input is None: - raise ValueError("Rest name was never set") - return self._rest_name_input - - def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin - # by this point, type and rest_name will have a value bc we default - # them in __new__ of the Model class - # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) - if item is None: - return item - if self._is_model: - return item - - # For mutable types, we want mutations to directly affect _data - # Check if we've already deserialized this value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - # Return the value from _data directly (it's been deserialized in place) - return obj._data.get(self._rest_name) - - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) - - # For mutable types, store the deserialized value back in _data - # so mutations directly affect _data - if isinstance(deserialized, (dict, list, set)): - obj._data[self._rest_name] = deserialized - object.__setattr__(obj, cache_attr, True) # Mark as deserialized - return deserialized - - return deserialized - - def __set__(self, obj: Model, value) -> None: - # Clear the cached deserialized object when setting a new value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - object.__delattr__(obj, cache_attr) - - if value is None: - # we want to wipe out entries if users set attr to None - try: - obj.__delitem__(self._rest_name) - except KeyError: - pass - return - if self._is_model: - if not _is_model(value): - value = _deserialize(self._type, value) - obj.__setitem__(self._rest_name, value) - return - obj.__setitem__(self._rest_name, _serialize(value, self._format)) - - def _get_deserialize_callable_from_annotation( - self, annotation: typing.Any - ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - return _get_deserialize_callable_from_annotation(annotation, self._module, self) - - -def rest_field( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField( - name=name, - type=type, - visibility=visibility, - default=default, - format=format, - is_multipart_file_input=is_multipart_file_input, - xml=xml, - ) - - -def rest_discriminator( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) - - -def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: - """Serialize a model to XML. - - :param Model model: The model to serialize. - :param bool exclude_readonly: Whether to exclude readonly properties. - :returns: The XML representation of the model. - :rtype: str - """ - return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore - - -def _get_element( - o: typing.Any, - exclude_readonly: bool = False, - parent_meta: typing.Optional[dict[str, typing.Any]] = None, - wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, list[ET.Element]]: - if _is_model(o): - model_meta = getattr(o, "_xml", {}) - - # if prop is a model, then use the prop element directly, else generate a wrapper of model - if wrapped_element is None: - wrapped_element = _create_xml_element( - model_meta.get("name", o.__class__.__name__), - model_meta.get("prefix"), - model_meta.get("ns"), - ) - - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - - for k, v in o.items(): - # do not serialize readonly properties - if exclude_readonly and k in readonly_props: - continue - - prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) - if prop_rest_field: - prop_meta = getattr(prop_rest_field, "_xml").copy() - # use the wire name as xml name if no specific name is set - if prop_meta.get("name") is None: - prop_meta["name"] = k - else: - # additional properties will not have rest field, use the wire name as xml name - prop_meta = {"name": k} - - # if no ns for prop, use model's - if prop_meta.get("ns") is None and model_meta.get("ns"): - prop_meta["ns"] = model_meta.get("ns") - prop_meta["prefix"] = model_meta.get("prefix") - - if prop_meta.get("unwrapped", False): - # unwrapped could only set on array - wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) - elif prop_meta.get("text", False): - # text could only set on primitive type - wrapped_element.text = _get_primitive_type_value(v) - elif prop_meta.get("attribute", False): - xml_name = prop_meta.get("name", k) - if prop_meta.get("ns"): - ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore - xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore - # attribute should be primitive type - wrapped_element.set(xml_name, _get_primitive_type_value(v)) - else: - # other wrapped prop element - wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) - return wrapped_element - if isinstance(o, list): - return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore - if isinstance(o, dict): - result = [] - for k, v in o.items(): - result.append( - _get_wrapped_element( - v, - exclude_readonly, - { - "name": k, - "ns": parent_meta.get("ns") if parent_meta else None, - "prefix": parent_meta.get("prefix") if parent_meta else None, - }, - ) - ) - return result - - # primitive case need to create element based on parent_meta - if parent_meta: - return _get_wrapped_element( - o, - exclude_readonly, - { - "name": parent_meta.get("itemsName", parent_meta.get("name")), - "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), - }, - ) - - raise ValueError("Could not serialize value into xml: " + o) - - -def _get_wrapped_element( - v: typing.Any, - exclude_readonly: bool, - meta: typing.Optional[dict[str, typing.Any]], -) -> ET.Element: - wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None - ) - if isinstance(v, (dict, list)): - wrapped_element.extend(_get_element(v, exclude_readonly, meta)) - elif _is_model(v): - _get_element(v, exclude_readonly, meta, wrapped_element) - else: - wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element # type: ignore[no-any-return] - - -def _get_primitive_type_value(v) -> str: - if v is True: - return "true" - if v is False: - return "false" - if isinstance(v, _Null): - return "" - return str(v) - - -def _create_xml_element( - tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None -) -> ET.Element: - if prefix and ns: - ET.register_namespace(prefix, ns) - if ns: - return ET.Element("{" + ns + "}" + tag) - return ET.Element(tag) - - -def _deserialize_xml( - deserializer: typing.Any, - value: str, -) -> typing.Any: - element = ET.fromstring(value) # nosec - return _deserialize(deserializer, element) - - -def _convert_element(e: ET.Element): - # dict case - if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: dict[str, typing.Any] = {} - for child in e: - if dict_result.get(child.tag) is not None: - if isinstance(dict_result[child.tag], list): - dict_result[child.tag].append(_convert_element(child)) - else: - dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] - else: - dict_result[child.tag] = _convert_element(child) - dict_result.update(e.attrib) - return dict_result - # array case - if len(e) > 0: - array_result: list[typing.Any] = [] - for child in e: - array_result.append(_convert_element(child)) - return array_result - # primitive case - return e.text diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/serialization.py deleted file mode 100644 index 81ec1de5922b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/utils.py deleted file mode 100644 index 35c9c836f85f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_utils/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_version.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_version.py deleted file mode 100644 index be71c81bd282..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b1" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/__init__.py deleted file mode 100644 index b3e6701bb3a5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import HeaderParamClient # type: ignore -from ._client import MultipleParamsClient # type: ignore -from ._client import MixedParamsClient # type: ignore -from ._client import PathParamClient # type: ignore -from ._client import ParamAliasClient # type: ignore -from ._client import ParentClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "HeaderParamClient", - "MultipleParamsClient", - "MixedParamsClient", - "PathParamClient", - "ParamAliasClient", - "ParentClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/_client.py deleted file mode 100644 index f0639c614360..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/_client.py +++ /dev/null @@ -1,507 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable -from typing_extensions import Self - -from azure.core import AsyncPipelineClient -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ( - HeaderParamClientConfiguration, - MixedParamsClientConfiguration, - MultipleParamsClientConfiguration, - ParamAliasClientConfiguration, - ParentClientConfiguration, - PathParamClientConfiguration, -) -from .operations import ( - ChildClientOperations, - _HeaderParamClientOperationsMixin, - _MixedParamsClientOperationsMixin, - _MultipleParamsClientOperationsMixin, - _ParamAliasClientOperationsMixin, - _PathParamClientOperationsMixin, -) - - -class HeaderParamClient(_HeaderParamClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Client for testing header parameter moved to client level. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = HeaderParamClientConfiguration(name=name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) - - -class MultipleParamsClient(_MultipleParamsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """MultipleParamsClient. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :param region: The region to use for all operations. This parameter is used as a query - parameter. Required. - :type region: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, name: str, region: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = MultipleParamsClientConfiguration(name=name, region=region, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) - - -class MixedParamsClient(_MixedParamsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """MixedParamsClient. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = MixedParamsClientConfiguration(name=name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) - - -class PathParamClient(_PathParamClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """PathParamClient. - - :param blob_name: The name of the blob. This parameter is used as a path parameter in all - operations. Required. - :type blob_name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, blob_name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = PathParamClientConfiguration(blob_name=blob_name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) - - -class ParamAliasClient(_ParamAliasClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """ParamAliasClient. - - :param blob_name: Blob name for the client. Required. - :type blob_name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, blob_name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = ParamAliasClientConfiguration(blob_name=blob_name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) - - -class ParentClient: # pylint: disable=client-accepts-api-version-keyword - """ParentClient. - - :ivar child_client: ChildClientOperations operations - :vartype child_client: - specs.azure.clientgenerator.core.clientinitialization.aio.operations.ChildClientOperations - :param blob_name: The name of the blob. This parameter is used as a path parameter in all - operations. Required. - :type blob_name: str - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, blob_name: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = ParentClientConfiguration(blob_name=blob_name, endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - self.child_client = ChildClientOperations(self._client, self._config, self._serialize, self._deserialize) - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/_configuration.py deleted file mode 100644 index fcf8902eb364..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/_configuration.py +++ /dev/null @@ -1,228 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from .._version import VERSION - - -class HeaderParamClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for HeaderParamClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if name is None: - raise ValueError("Parameter 'name' must not be None.") - - self.name = name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class MultipleParamsClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for MultipleParamsClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :param region: The region to use for all operations. This parameter is used as a query - parameter. Required. - :type region: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, name: str, region: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if name is None: - raise ValueError("Parameter 'name' must not be None.") - if region is None: - raise ValueError("Parameter 'region' must not be None.") - - self.name = name - self.region = region - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class MixedParamsClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for MixedParamsClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param name: The name of the client. This parameter is used as a header in all operations. - Required. - :type name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if name is None: - raise ValueError("Parameter 'name' must not be None.") - - self.name = name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class PathParamClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for PathParamClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param blob_name: The name of the blob. This parameter is used as a path parameter in all - operations. Required. - :type blob_name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, blob_name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if blob_name is None: - raise ValueError("Parameter 'blob_name' must not be None.") - - self.blob_name = blob_name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class ParamAliasClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ParamAliasClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param blob_name: Blob name for the client. Required. - :type blob_name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, blob_name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if blob_name is None: - raise ValueError("Parameter 'blob_name' must not be None.") - - self.blob_name = blob_name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - - -class ParentClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ParentClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param blob_name: The name of the blob. This parameter is used as a path parameter in all - operations. Required. - :type blob_name: str - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, blob_name: str, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - if blob_name is None: - raise ValueError("Parameter 'blob_name' must not be None.") - - self.blob_name = blob_name - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "specs-azure-clientgenerator-core-clientinitialization/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/_patch.py deleted file mode 100644 index 8bcb627aa475..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/operations/__init__.py deleted file mode 100644 index 55b4923903eb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/operations/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _HeaderParamClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _MultipleParamsClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _MixedParamsClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _PathParamClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _ParamAliasClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import ChildClientOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ChildClientOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/operations/_operations.py deleted file mode 100644 index f9d5c19952c4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/operations/_operations.py +++ /dev/null @@ -1,960 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import models as _models -from ..._utils.model_base import SdkJSONEncoder, _deserialize -from ..._utils.serialization import Deserializer, Serializer -from ..._utils.utils import ClientMixinABC -from ...operations._operations import ( - build_child_client_delete_standalone_request, - build_child_client_get_standalone_request, - build_child_client_with_query_request, - build_header_param_with_body_request, - build_header_param_with_query_request, - build_mixed_params_with_body_request, - build_mixed_params_with_query_request, - build_multiple_params_with_body_request, - build_multiple_params_with_query_request, - build_param_alias_with_aliased_name_request, - build_param_alias_with_original_name_request, - build_path_param_delete_standalone_request, - build_path_param_get_standalone_request, - build_path_param_with_query_request, -) -from .._configuration import ( - HeaderParamClientConfiguration, - MixedParamsClientConfiguration, - MultipleParamsClientConfiguration, - ParamAliasClientConfiguration, - ParentClientConfiguration, - PathParamClientConfiguration, -) - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _HeaderParamClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], HeaderParamClientConfiguration] -): - - @distributed_trace_async - async def with_query(self, *, id: str, **kwargs: Any) -> None: - """with_query. - - :keyword id: Required. - :paramtype id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_param_with_query_request( - id=id, - name=self._config.name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def with_body(self, body: _models.Input, *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.Input - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def with_body(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def with_body(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def with_body(self, body: Union[_models.Input, JSON, IO[bytes]], **kwargs: Any) -> None: - """with_body. - - :param body: Is one of the following types: Input, JSON, IO[bytes] Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.Input or JSON or - IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_header_param_with_body_request( - name=self._config.name, - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _MultipleParamsClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], MultipleParamsClientConfiguration] -): - - @distributed_trace_async - async def with_query(self, *, id: str, **kwargs: Any) -> None: - """with_query. - - :keyword id: Required. - :paramtype id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_multiple_params_with_query_request( - id=id, - name=self._config.name, - region=self._config.region, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def with_body(self, body: _models.Input, *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.Input - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def with_body(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def with_body(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def with_body(self, body: Union[_models.Input, JSON, IO[bytes]], **kwargs: Any) -> None: - """with_body. - - :param body: Is one of the following types: Input, JSON, IO[bytes] Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.Input or JSON or - IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_multiple_params_with_body_request( - name=self._config.name, - region=self._config.region, - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _MixedParamsClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], MixedParamsClientConfiguration] -): - - @distributed_trace_async - async def with_query(self, *, region: str, id: str, **kwargs: Any) -> None: - """with_query. - - :keyword region: Required. - :paramtype region: str - :keyword id: Required. - :paramtype id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_mixed_params_with_query_request( - region=region, - id=id, - name=self._config.name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def with_body( - self, body: _models.WithBodyRequest, *, region: str, content_type: str = "application/json", **kwargs: Any - ) -> None: - """with_body. - - :param body: Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.WithBodyRequest - :keyword region: Required. - :paramtype region: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def with_body( - self, body: JSON, *, region: str, content_type: str = "application/json", **kwargs: Any - ) -> None: - """with_body. - - :param body: Required. - :type body: JSON - :keyword region: Required. - :paramtype region: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def with_body( - self, body: IO[bytes], *, region: str, content_type: str = "application/json", **kwargs: Any - ) -> None: - """with_body. - - :param body: Required. - :type body: IO[bytes] - :keyword region: Required. - :paramtype region: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def with_body( - self, body: Union[_models.WithBodyRequest, JSON, IO[bytes]], *, region: str, **kwargs: Any - ) -> None: - """with_body. - - :param body: Is one of the following types: WithBodyRequest, JSON, IO[bytes] Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.WithBodyRequest or - JSON or IO[bytes] - :keyword region: Required. - :paramtype region: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_mixed_params_with_body_request( - region=region, - name=self._config.name, - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _PathParamClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], PathParamClientConfiguration] -): - - @distributed_trace_async - async def with_query(self, *, format: Optional[str] = None, **kwargs: Any) -> None: - """with_query. - - :keyword format: Default value is None. - :paramtype format: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_param_with_query_request( - blob_name=self._config.blob_name, - format=format, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_standalone(self, **kwargs: Any) -> _models.BlobProperties: - """get_standalone. - - :return: BlobProperties. The BlobProperties is compatible with MutableMapping - :rtype: ~specs.azure.clientgenerator.core.clientinitialization.models.BlobProperties - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.BlobProperties] = kwargs.pop("cls", None) - - _request = build_path_param_get_standalone_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.BlobProperties, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete_standalone(self, **kwargs: Any) -> None: - """delete_standalone. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_param_delete_standalone_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _ParamAliasClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], ParamAliasClientConfiguration] -): - - @distributed_trace_async - async def with_aliased_name(self, **kwargs: Any) -> None: - """with_aliased_name. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_param_alias_with_aliased_name_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def with_original_name(self, **kwargs: Any) -> None: - """with_original_name. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_param_alias_with_original_name_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ChildClientOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~specs.azure.clientgenerator.core.clientinitialization.aio.ParentClient`'s - :attr:`child_client` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ParentClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def with_query(self, *, format: Optional[str] = None, **kwargs: Any) -> None: - """with_query. - - :keyword format: Default value is None. - :paramtype format: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_child_client_with_query_request( - blob_name=self._config.blob_name, - format=format, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_standalone(self, **kwargs: Any) -> _models.BlobProperties: - """get_standalone. - - :return: BlobProperties. The BlobProperties is compatible with MutableMapping - :rtype: ~specs.azure.clientgenerator.core.clientinitialization.models.BlobProperties - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.BlobProperties] = kwargs.pop("cls", None) - - _request = build_child_client_get_standalone_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.BlobProperties, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete_standalone(self, **kwargs: Any) -> None: - """delete_standalone. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_child_client_delete_standalone_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/operations/_patch.py deleted file mode 100644 index 8bcb627aa475..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/aio/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/models/__init__.py deleted file mode 100644 index 08806180ab50..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/models/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models import ( # type: ignore - BlobProperties, - Input, - WithBodyRequest, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "BlobProperties", - "Input", - "WithBodyRequest", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/models/_models.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/models/_models.py deleted file mode 100644 index 5a973dd3c659..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/models/_models.py +++ /dev/null @@ -1,114 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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, Mapping, overload - -from .._utils.model_base import Model as _Model, rest_field - - -class BlobProperties(_Model): - """Properties of a blob. - - :ivar name: Required. - :vartype name: str - :ivar size: Required. - :vartype size: int - :ivar content_type: Required. - :vartype content_type: str - :ivar created_on: Required. - :vartype created_on: ~datetime.datetime - """ - - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - size: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - content_type: str = rest_field(name="contentType", visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - created_on: datetime.datetime = rest_field( - name="createdOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """Required.""" - - @overload - def __init__( - self, - *, - name: str, - size: int, - content_type: str, - created_on: datetime.datetime, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Input(_Model): - """Input. - - :ivar name: Required. - :vartype name: str - """ - - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - name: str, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class WithBodyRequest(_Model): - """WithBodyRequest. - - :ivar name: Required. - :vartype name: str - """ - - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - name: str, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/models/_patch.py deleted file mode 100644 index 8bcb627aa475..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/models/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/operations/__init__.py deleted file mode 100644 index 55b4923903eb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/operations/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _HeaderParamClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _MultipleParamsClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _MixedParamsClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _PathParamClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _ParamAliasClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import ChildClientOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ChildClientOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/operations/_operations.py deleted file mode 100644 index 9f103b354575..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/operations/_operations.py +++ /dev/null @@ -1,1190 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models -from .._configuration import ( - HeaderParamClientConfiguration, - MixedParamsClientConfiguration, - MultipleParamsClientConfiguration, - ParamAliasClientConfiguration, - ParentClientConfiguration, - PathParamClientConfiguration, -) -from .._utils.model_base import SdkJSONEncoder, _deserialize -from .._utils.serialization import Deserializer, Serializer -from .._utils.utils import ClientMixinABC - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_header_param_with_query_request(*, id: str, name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/azure/client-generator-core/client-initialization/header-param/with-query" - - # Construct parameters - _params["id"] = _SERIALIZER.query("id", id, "str") - - # Construct headers - _headers["name"] = _SERIALIZER.header("name", name, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_header_param_with_body_request(*, name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/azure/client-generator-core/client-initialization/header-param/with-body" - - # Construct headers - _headers["name"] = _SERIALIZER.header("name", name, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_multiple_params_with_query_request(*, id: str, name: str, region: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/azure/client-generator-core/client-initialization/multiple-params/with-query" - - # Construct parameters - _params["region"] = _SERIALIZER.query("region", region, "str") - _params["id"] = _SERIALIZER.query("id", id, "str") - - # Construct headers - _headers["name"] = _SERIALIZER.header("name", name, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_multiple_params_with_body_request(*, name: str, region: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/azure/client-generator-core/client-initialization/multiple-params/with-body" - - # Construct parameters - _params["region"] = _SERIALIZER.query("region", region, "str") - - # Construct headers - _headers["name"] = _SERIALIZER.header("name", name, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_mixed_params_with_query_request(*, region: str, id: str, name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/azure/client-generator-core/client-initialization/mixed-params/with-query" - - # Construct parameters - _params["region"] = _SERIALIZER.query("region", region, "str") - _params["id"] = _SERIALIZER.query("id", id, "str") - - # Construct headers - _headers["name"] = _SERIALIZER.header("name", name, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_mixed_params_with_body_request(*, region: str, name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/azure/client-generator-core/client-initialization/mixed-params/with-body" - - # Construct parameters - _params["region"] = _SERIALIZER.query("region", region, "str") - - # Construct headers - _headers["name"] = _SERIALIZER.header("name", name, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_path_param_with_query_request(blob_name: str, *, format: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/azure/client-generator-core/client-initialization/path/{blobName}/with-query" - path_format_arguments = { - "blobName": _SERIALIZER.url("blob_name", blob_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if format is not None: - _params["format"] = _SERIALIZER.query("format", format, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_path_param_get_standalone_request(blob_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/azure/client-generator-core/client-initialization/path/{blobName}/get-standalone" - path_format_arguments = { - "blobName": _SERIALIZER.url("blob_name", blob_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_path_param_delete_standalone_request( # pylint: disable=name-too-long - blob_name: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/azure/client-generator-core/client-initialization/path/{blobName}" - path_format_arguments = { - "blobName": _SERIALIZER.url("blob_name", blob_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="DELETE", url=_url, **kwargs) - - -def build_param_alias_with_aliased_name_request( # pylint: disable=name-too-long - blob_name: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/azure/client-generator-core/client-initialization/param-alias/{blob}/with-aliased-name" - path_format_arguments = { - "blob": _SERIALIZER.url("blob_name", blob_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_param_alias_with_original_name_request( # pylint: disable=name-too-long - blob_name: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/azure/client-generator-core/client-initialization/param-alias/{blobName}/with-original-name" - path_format_arguments = { - "blobName": _SERIALIZER.url("blob_name", blob_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_child_client_with_query_request( - blob_name: str, *, format: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/azure/client-generator-core/client-initialization/child-client/{blobName}/with-query" - path_format_arguments = { - "blobName": _SERIALIZER.url("blob_name", blob_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if format is not None: - _params["format"] = _SERIALIZER.query("format", format, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_child_client_get_standalone_request( # pylint: disable=name-too-long - blob_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/azure/client-generator-core/client-initialization/child-client/{blobName}/get-standalone" - path_format_arguments = { - "blobName": _SERIALIZER.url("blob_name", blob_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_child_client_delete_standalone_request( # pylint: disable=name-too-long - blob_name: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/azure/client-generator-core/client-initialization/child-client/{blobName}" - path_format_arguments = { - "blobName": _SERIALIZER.url("blob_name", blob_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="DELETE", url=_url, **kwargs) - - -class _HeaderParamClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], HeaderParamClientConfiguration] -): - - @distributed_trace - def with_query(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """with_query. - - :keyword id: Required. - :paramtype id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_param_with_query_request( - id=id, - name=self._config.name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def with_body(self, body: _models.Input, *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.Input - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def with_body(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def with_body(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def with_body( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.Input, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """with_body. - - :param body: Is one of the following types: Input, JSON, IO[bytes] Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.Input or JSON or - IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_header_param_with_body_request( - name=self._config.name, - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _MultipleParamsClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], MultipleParamsClientConfiguration] -): - - @distributed_trace - def with_query(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """with_query. - - :keyword id: Required. - :paramtype id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_multiple_params_with_query_request( - id=id, - name=self._config.name, - region=self._config.region, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def with_body(self, body: _models.Input, *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.Input - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def with_body(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def with_body(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def with_body( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.Input, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """with_body. - - :param body: Is one of the following types: Input, JSON, IO[bytes] Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.Input or JSON or - IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_multiple_params_with_body_request( - name=self._config.name, - region=self._config.region, - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _MixedParamsClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], MixedParamsClientConfiguration] -): - - @distributed_trace - def with_query( # pylint: disable=inconsistent-return-statements - self, *, region: str, id: str, **kwargs: Any - ) -> None: - """with_query. - - :keyword region: Required. - :paramtype region: str - :keyword id: Required. - :paramtype id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_mixed_params_with_query_request( - region=region, - id=id, - name=self._config.name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def with_body( - self, body: _models.WithBodyRequest, *, region: str, content_type: str = "application/json", **kwargs: Any - ) -> None: - """with_body. - - :param body: Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.WithBodyRequest - :keyword region: Required. - :paramtype region: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def with_body(self, body: JSON, *, region: str, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: JSON - :keyword region: Required. - :paramtype region: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def with_body(self, body: IO[bytes], *, region: str, content_type: str = "application/json", **kwargs: Any) -> None: - """with_body. - - :param body: Required. - :type body: IO[bytes] - :keyword region: Required. - :paramtype region: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def with_body( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.WithBodyRequest, JSON, IO[bytes]], *, region: str, **kwargs: Any - ) -> None: - """with_body. - - :param body: Is one of the following types: WithBodyRequest, JSON, IO[bytes] Required. - :type body: ~specs.azure.clientgenerator.core.clientinitialization.models.WithBodyRequest or - JSON or IO[bytes] - :keyword region: Required. - :paramtype region: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_mixed_params_with_body_request( - region=region, - name=self._config.name, - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _PathParamClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], PathParamClientConfiguration] -): - - @distributed_trace - def with_query( # pylint: disable=inconsistent-return-statements - self, *, format: Optional[str] = None, **kwargs: Any - ) -> None: - """with_query. - - :keyword format: Default value is None. - :paramtype format: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_param_with_query_request( - blob_name=self._config.blob_name, - format=format, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_standalone(self, **kwargs: Any) -> _models.BlobProperties: - """get_standalone. - - :return: BlobProperties. The BlobProperties is compatible with MutableMapping - :rtype: ~specs.azure.clientgenerator.core.clientinitialization.models.BlobProperties - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.BlobProperties] = kwargs.pop("cls", None) - - _request = build_path_param_get_standalone_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.BlobProperties, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete_standalone(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """delete_standalone. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_param_delete_standalone_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _ParamAliasClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], ParamAliasClientConfiguration] -): - - @distributed_trace - def with_aliased_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """with_aliased_name. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_param_alias_with_aliased_name_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def with_original_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """with_original_name. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_param_alias_with_original_name_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ChildClientOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~specs.azure.clientgenerator.core.clientinitialization.ParentClient`'s - :attr:`child_client` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ParentClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def with_query( # pylint: disable=inconsistent-return-statements - self, *, format: Optional[str] = None, **kwargs: Any - ) -> None: - """with_query. - - :keyword format: Default value is None. - :paramtype format: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_child_client_with_query_request( - blob_name=self._config.blob_name, - format=format, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_standalone(self, **kwargs: Any) -> _models.BlobProperties: - """get_standalone. - - :return: BlobProperties. The BlobProperties is compatible with MutableMapping - :rtype: ~specs.azure.clientgenerator.core.clientinitialization.models.BlobProperties - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.BlobProperties] = kwargs.pop("cls", None) - - _request = build_child_client_get_standalone_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.BlobProperties, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete_standalone(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """delete_standalone. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_child_client_delete_standalone_request( - blob_name=self._config.blob_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/operations/_patch.py deleted file mode 100644 index 8bcb627aa475..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/py.typed b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-initialization/specs/azure/clientgenerator/core/clientinitialization/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/types.py deleted file mode 100644 index a2ad927fac5d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/types.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Blob(TypedDict, total=False): - """Blob. - - :ivar id: Required. - :vartype id: str - :ivar name: Required. - :vartype name: str - :ivar size: Required. - :vartype size: int - :ivar path: Required. - :vartype path: str - """ - - id: Required[str] - """Required.""" - name: Required[str] - """Required.""" - size: Required[int] - """Required.""" - path: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/types.py deleted file mode 100644 index f429ced602f9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class ResponseModel(TypedDict, total=False): - """This is a Model contains a string-like property of type url. - - :ivar sample_url: Required. - :vartype sample_url: str - """ - - sampleUrl: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/model/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/model/types.py deleted file mode 100644 index 5c2bf65cf235..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/model/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class My_model(TypedDict, total=False): - """My_model. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/property/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/property/types.py deleted file mode 100644 index 4c53b8bceba1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/property/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class ScopedModel(TypedDict, total=False): - """ScopedModel. - - :ivar _my_name: Required. - :vartype _my_name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/types.py deleted file mode 100644 index 2fe5da86c949..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/types.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any -from typing_extensions import Required, TypedDict - - -class ChildFlattenModel(TypedDict, total=False): - """This is the child model to be flattened. And it has flattened property as well. - - :ivar summary: Required. - :vartype summary: str - :ivar properties: Required. - :vartype properties: ~specs.azure.clientgenerator.core.flattenproperty.models.ChildModel - """ - - summary: Required[str] - """Required.""" - properties: Required["ChildModel"] - """Required.""" - - -class ChildModel(TypedDict, total=False): - """This is the child model to be flattened. - - :ivar description: Required. - :vartype description: str - :ivar age: Required. - :vartype age: int - """ - - description: Required[str] - """Required.""" - age: Required[int] - """Required.""" - - -class FlattenModel(TypedDict, total=False): - """This is the model with one level of flattening. - - :ivar name: Required. - :vartype name: str - :ivar properties: Required. - :vartype properties: ~specs.azure.clientgenerator.core.flattenproperty.models.ChildModel - """ - - name: Required[str] - """Required.""" - properties: Required["ChildModel"] - """Required.""" - - -class FlattenUnknownModel(TypedDict, total=False): - """This is the model with unknown type properties to be flattened. - - :ivar name: Required. - :vartype name: str - :ivar properties: - :vartype properties: any - """ - - name: Required[str] - """Required.""" - properties: Any - - -class NestedFlattenModel(TypedDict, total=False): - """This is the model with two levels of flattening. - - :ivar name: Required. - :vartype name: str - :ivar properties: Required. - :vartype properties: ~specs.azure.clientgenerator.core.flattenproperty.models.ChildFlattenModel - """ - - name: Required[str] - """Required.""" - properties: Required["ChildFlattenModel"] - """Required.""" - - -class Solution(TypedDict, total=False): - """This is the model with flattened properties that are all read-only. - - :ivar name: Required. - :vartype name: str - :ivar properties: - :vartype properties: - ~specs.azure.clientgenerator.core.flattenproperty.models.SolutionProperties - """ - - name: Required[str] - """Required.""" - properties: "SolutionProperties" - - -class SolutionProperties(TypedDict, total=False): - """This is the model with all read-only properties to be flattened. - - :ivar solution_id: - :vartype solution_id: str - :ivar title: - :vartype title: str - :ivar content: - :vartype content: str - """ - - solutionId: str - title: str - content: str diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/dev_requirements.txt b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/dev_requirements.txt index 105486471444..0e53b6a72db5 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/dev_requirements.txt +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/dev_requirements.txt @@ -1,3 +1,3 @@ --e ../../../tools/azure-sdk-tools +-e ../../../eng/tools/azure-sdk-tools ../../core/azure-core aiohttp \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/types.py deleted file mode 100644 index d6daadc1e41b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/types.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class Dog(TypedDict, total=False): - """Dog. - - :ivar name: Name of the animal. Required. - :vartype name: str - :ivar trained: Whether the pet is trained. Required. - :vartype trained: bool - :ivar kind: Required. Default value is "dog". - :vartype kind: str - :ivar breed: The breed of the dog. Required. - :vartype breed: str - """ - - name: Required[str] - """Name of the animal. Required.""" - trained: Required[bool] - """Whether the pet is trained. Required.""" - kind: Required[Literal["dog"]] - """Required. Default value is \"dog\".""" - breed: Required[str] - """The breed of the dog. Required.""" - - -Pet = Union[Dog] -Animal = Union[Dog, Pet] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/types.py deleted file mode 100644 index 2f43503b4b5a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Test(TypedDict, total=False): - """Test model. - - :ivar id: The id of the test. Required. - :vartype id: str - """ - - id: Required[str] - """The id of the test. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/types.py deleted file mode 100644 index 70a993e90c00..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/types.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import TypedDict - - -class GroupParametersOptions(TypedDict, total=False): - """GroupParametersOptions.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/types.py deleted file mode 100644 index fe0b2d04ccf2..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/types.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class InputModel(TypedDict, total=False): - """Usage additive to roundtrip. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class OrphanModel(TypedDict, total=False): - """Not used anywhere, but access is override to public so still need to be generated and exported - with serialization. - - :ivar model_name: Required. - :vartype model_name: str - :ivar description: Required. - :vartype description: str - """ - - name: Required[str] - """Required.""" - desc: Required[str] - """Required.""" - - -class OutputModel(TypedDict, total=False): - """Usage additive to roundtrip. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ResultModel(TypedDict, total=False): - """ResultModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class RoundTripModel(TypedDict, total=False): - """RoundTripModel. - - :ivar result: Required. - :vartype result: ~specs.azure.clientgenerator.core.usage.models.ResultModel - """ - - result: Required["ResultModel"] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/types.py deleted file mode 100644 index 03c07f602247..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-basic/specs/azure/core/basic/types.py +++ /dev/null @@ -1,62 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class User(TypedDict, total=False): - """Details about a user. - - :ivar id: The user's id. Required. - :vartype id: int - :ivar name: The user's name. Required. - :vartype name: str - :ivar orders: The user's order list. - :vartype orders: list[~specs.azure.core.basic.models.UserOrder] - :ivar etag: The entity tag for this resource. Required. - :vartype etag: str - """ - - id: Required[int] - """The user's id. Required.""" - name: Required[str] - """The user's name. Required.""" - orders: list["UserOrder"] - """The user's order list.""" - etag: Required[str] - """The entity tag for this resource. Required.""" - - -class UserList(TypedDict, total=False): - """UserList. - - :ivar users: Required. - :vartype users: list[~specs.azure.core.basic.models.User] - """ - - users: Required[list["User"]] - """Required.""" - - -class UserOrder(TypedDict, total=False): - """UserOrder for testing list with expand. - - :ivar id: The user's id. Required. - :vartype id: int - :ivar user_id: The user's id. Required. - :vartype user_id: int - :ivar detail: The user's order detail. Required. - :vartype detail: str - """ - - id: Required[int] - """The user's id. Required.""" - userId: Required[int] - """The user's id. Required.""" - detail: Required[str] - """The user's order detail. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/types.py deleted file mode 100644 index 9b3bc6f4e284..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/types.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class GenerationOptions(TypedDict, total=False): - """Options for the generation. - - :ivar prompt: Prompt. Required. - :vartype prompt: str - """ - - prompt: Required[str] - """Prompt. Required.""" - - -class GenerationResult(TypedDict, total=False): - """Result of the generation. - - :ivar data: The data. Required. - :vartype data: str - """ - - data: Required[str] - """The data. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/types.py deleted file mode 100644 index a0844fed0b43..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/types.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class ExportedUser(TypedDict, total=False): - """The exported user data. - - :ivar name: The name of user. Required. - :vartype name: str - :ivar resource_uri: The exported URI. Required. - :vartype resource_uri: str - """ - - name: Required[str] - """The name of user. Required.""" - resourceUri: Required[str] - """The exported URI. Required.""" - - -class User(TypedDict, total=False): - """Details about a user. - - :ivar name: The name of user. Required. - :vartype name: str - :ivar role: The role of user. Required. - :vartype role: str - """ - - name: Required[str] - """The name of user. Required.""" - role: Required[str] - """The role of user. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/types.py deleted file mode 100644 index fa2a1ca41834..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-model/specs/azure/core/model/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class AzureEmbeddingModel(TypedDict, total=False): - """AzureEmbeddingModel. - - :ivar embedding: Required. - :vartype embedding: list[int] - """ - - embedding: Required[list[int]] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/types.py deleted file mode 100644 index 7091cc237d43..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-page/specs/azure/core/page/types.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class FirstItem(TypedDict, total=False): - """First item. - - :ivar id: The id of the item. Required. - :vartype id: int - """ - - id: Required[int] - """The id of the item. Required.""" - - -class ListItemInputBody(TypedDict, total=False): - """The body of the input. - - :ivar input_name: The name of the input. Required. - :vartype input_name: str - """ - - inputName: Required[str] - """The name of the input. Required.""" - - -class SecondItem(TypedDict, total=False): - """Second item. - - :ivar name: The name of the item. Required. - :vartype name: str - """ - - name: Required[str] - """The name of the item. Required.""" - - -class User(TypedDict, total=False): - """Details about a user. - - :ivar id: The user's id. Required. - :vartype id: int - :ivar name: The user's name. Required. - :vartype name: str - :ivar orders: The user's order list. - :vartype orders: list[~specs.azure.core.page.models.UserOrder] - :ivar etag: The entity tag for this resource. Required. - :vartype etag: str - """ - - id: Required[int] - """The user's id. Required.""" - name: Required[str] - """The user's name. Required.""" - orders: list["UserOrder"] - """The user's order list.""" - etag: Required[str] - """The entity tag for this resource. Required.""" - - -class UserOrder(TypedDict, total=False): - """UserOrder for testing list with expand. - - :ivar id: The user's id. Required. - :vartype id: int - :ivar user_id: The user's id. Required. - :vartype user_id: int - :ivar detail: The user's order detail. Required. - :vartype detail: str - """ - - id: Required[int] - """The user's id. Required.""" - userId: Required[int] - """The user's id. Required.""" - detail: Required[str] - """The user's order detail. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/types.py deleted file mode 100644 index 79c5e77321e1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-scalar/specs/azure/core/scalar/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class AzureLocationModel(TypedDict, total=False): - """AzureLocationModel. - - :ivar location: Required. - :vartype location: str - """ - - location: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/types.py deleted file mode 100644 index 321efad9915b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-core-traits/specs/azure/core/traits/types.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class User(TypedDict, total=False): - """Sample Model. - - :ivar id: The user's id. Required. - :vartype id: int - :ivar name: The user's name. - :vartype name: str - """ - - id: Required[int] - """The user's id. Required.""" - name: str - """The user's name.""" - - -class UserActionParam(TypedDict, total=False): - """User action param. - - :ivar user_action_value: User action value. Required. - :vartype user_action_value: str - """ - - userActionValue: Required[str] - """User action value. Required.""" - - -class UserActionResponse(TypedDict, total=False): - """User action response. - - :ivar user_action_result: User action result. Required. - :vartype user_action_result: str - """ - - userActionResult: Required[str] - """User action result. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/types.py deleted file mode 100644 index 4e7deabbf7b4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-encode-duration/specs/azure/encode/duration/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class DurationModel(TypedDict, total=False): - """DurationModel. - - :ivar input: Required. - :vartype input: str - """ - - input: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/types.py deleted file mode 100644 index a0098bcf0e1c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-example-basic/specs/azure/example/basic/types.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import EnumEnum - - -class ActionRequest(TypedDict, total=False): - """ActionRequest. - - :ivar string_property: Required. - :vartype string_property: str - :ivar model_property: - :vartype model_property: ~specs.azure.example.basic.models.Model - :ivar array_property: - :vartype array_property: list[str] - :ivar record_property: - :vartype record_property: dict[str, str] - """ - - stringProperty: Required[str] - """Required.""" - modelProperty: "Model" - arrayProperty: list[str] - recordProperty: dict[str, str] - - -class ActionResponse(TypedDict, total=False): - """ActionResponse. - - :ivar string_property: Required. - :vartype string_property: str - :ivar model_property: - :vartype model_property: ~specs.azure.example.basic.models.Model - :ivar array_property: - :vartype array_property: list[str] - :ivar record_property: - :vartype record_property: dict[str, str] - """ - - stringProperty: Required[str] - """Required.""" - modelProperty: "Model" - arrayProperty: list[str] - recordProperty: dict[str, str] - - -class Model(TypedDict, total=False): - """Model. - - :ivar int32_property: - :vartype int32_property: int - :ivar float32_property: - :vartype float32_property: float - :ivar enum_property: "EnumValue1" - :vartype enum_property: str or ~specs.azure.example.basic.models.EnumEnum - """ - - int32Property: int - float32Property: float - enumProperty: Union[str, "EnumEnum"] - """\"EnumValue1\"""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/types.py deleted file mode 100644 index c56cde5f1669..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class User(TypedDict, total=False): - """User model. - - :ivar name: User name. Required. - :vartype name: str - """ - - name: Required[str] - """User name. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/types.py deleted file mode 100644 index 89507752adbd..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/types.py +++ /dev/null @@ -1,362 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import CreatedByType, ManagedServiceIdentityType - - -class ApiError(TypedDict, total=False): - """Api error. - - :ivar details: The Api error details. - :vartype details: list[~azure.resourcemanager.commonproperties.models.ApiErrorBase] - :ivar innererror: The Api inner error. - :vartype innererror: ~azure.resourcemanager.commonproperties.models.InnerError - :ivar code: The error code. - :vartype code: str - :ivar target: The target of the particular error. - :vartype target: str - :ivar message: The error message. - :vartype message: str - """ - - details: list["ApiErrorBase"] - """The Api error details.""" - innererror: "InnerError" - """The Api inner error.""" - code: str - """The error code.""" - target: str - """The target of the particular error.""" - message: str - """The error message.""" - - -class ApiErrorBase(TypedDict, total=False): - """Api error base. - - :ivar code: The error code. - :vartype code: str - :ivar target: The target of the particular error. - :vartype target: str - :ivar message: The error message. - :vartype message: str - """ - - code: str - """The error code.""" - target: str - """The target of the particular error.""" - message: str - """The error message.""" - - -class CloudError(TypedDict, total=False): - """An error response. - - :ivar error: Api error. - :vartype error: ~azure.resourcemanager.commonproperties.models.ApiError - """ - - error: "ApiError" - """Api error.""" - - -class Resource(TypedDict, total=False): - """Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.commonproperties.models.SystemData - """ - - id: str - """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" - name: str - """The name of the resource.""" - type: str - """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or - \"Microsoft.Storage/storageAccounts\".""" - systemData: "SystemData" - """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" - - -class TrackedResource(Resource): - """Tracked Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.commonproperties.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - tags: dict[str, str] - """Resource tags.""" - location: Required[str] - """The geo-location where the resource lives. Required.""" - - -class ConfidentialResource(TrackedResource): - """Concrete tracked resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.commonproperties.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties - """ - - properties: "ConfidentialResourceProperties" - """The resource-specific properties for this resource.""" - - -class ConfidentialResourceProperties(TypedDict, total=False): - """Confidential Resource Properties. - - :ivar provisioning_state: The status of the last operation. Required. - :vartype provisioning_state: str - :ivar username: Required. - :vartype username: str - """ - - provisioningState: Required[str] - """The status of the last operation. Required.""" - username: Required[str] - """Required.""" - - -class ErrorAdditionalInfo(TypedDict, total=False): - """The resource management error additional info. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: str - """The additional info type.""" - info: Any - """The additional info.""" - - -class ErrorDetail(TypedDict, total=False): - """The error detail. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.resourcemanager.commonproperties.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.resourcemanager.commonproperties.models.ErrorAdditionalInfo] - """ - - code: str - """The error code.""" - message: str - """The error message.""" - target: str - """The error target.""" - details: list["ErrorDetail"] - """The error details.""" - additionalInfo: list["ErrorAdditionalInfo"] - """The error additional info.""" - - -class ErrorResponse(TypedDict, total=False): - """Error response. - - :ivar error: The error object. - :vartype error: ~azure.resourcemanager.commonproperties.models.ErrorDetail - """ - - error: "ErrorDetail" - """The error object.""" - - -class InnerError(TypedDict, total=False): - """Inner error details. - - :ivar exceptiontype: The exception type. - :vartype exceptiontype: str - :ivar errordetail: The internal error message or exception dump. - :vartype errordetail: str - """ - - exceptiontype: str - """The exception type.""" - errordetail: str - """The internal error message or exception dump.""" - - -class ManagedIdentityTrackedResource(TrackedResource): - """Concrete tracked resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.commonproperties.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: ~azure.resourcemanager.commonproperties.models.ManagedServiceIdentity - """ - - properties: "ManagedIdentityTrackedResourceProperties" - """The resource-specific properties for this resource.""" - identity: "ManagedServiceIdentity" - """The managed service identities assigned to this resource.""" - - -class ManagedIdentityTrackedResourceProperties(TypedDict, total=False): - """Managed Identity Arm Resource Properties. - - :ivar provisioning_state: The status of the last operation. Required. - :vartype provisioning_state: str - """ - - provisioningState: Required[str] - """The status of the last operation. Required.""" - - -class ManagedServiceIdentity(TypedDict, total=False): - """Managed service identity (system assigned and/or user assigned identities). - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: The type of managed identity assigned to this resource. Required. Known values are: - "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.resourcemanager.commonproperties.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The identities assigned to this resource by the user. - :vartype user_assigned_identities: dict[str, - ~azure.resourcemanager.commonproperties.models.UserAssignedIdentity] - """ - - principalId: str - """The service principal ID of the system assigned identity. This property will only be provided - for a system assigned identity.""" - tenantId: str - """The tenant ID of the system assigned identity. This property will only be provided for a system - assigned identity.""" - type: Required[Union[str, "ManagedServiceIdentityType"]] - """The type of managed identity assigned to this resource. Required. Known values are: \"None\", - \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" - userAssignedIdentities: dict[str, "UserAssignedIdentity"] - """The identities assigned to this resource by the user.""" - - -class SystemData(TypedDict, total=False): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.resourcemanager.commonproperties.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.resourcemanager.commonproperties.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - createdBy: str - """The identity that created the resource.""" - createdByType: Union[str, "CreatedByType"] - """The type of identity that created the resource. Known values are: \"User\", \"Application\", - \"ManagedIdentity\", and \"Key\".""" - createdAt: datetime.datetime - """The timestamp of resource creation (UTC).""" - lastModifiedBy: str - """The identity that last modified the resource.""" - lastModifiedByType: Union[str, "CreatedByType"] - """The type of identity that last modified the resource. Known values are: \"User\", - \"Application\", \"ManagedIdentity\", and \"Key\".""" - lastModifiedAt: datetime.datetime - """The timestamp of resource last modification (UTC).""" - - -class UserAssignedIdentity(TypedDict, total=False): - """User assigned identity properties. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - principalId: str - """The principal ID of the assigned identity.""" - clientId: str - """The client ID of the assigned identity.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/types.py deleted file mode 100644 index 3213e4762765..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/types.py +++ /dev/null @@ -1,74 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any -from typing_extensions import Required, TypedDict - - -class CancelResult(TypedDict, total=False): - """CancelResult. - - :ivar succeeded: Required. - :vartype succeeded: bool - """ - - succeeded: Required[bool] - """Required.""" - - -class ErrorAdditionalInfo(TypedDict, total=False): - """The resource management error additional info. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: str - """The additional info type.""" - info: Any - """The additional info.""" - - -class ErrorDetail(TypedDict, total=False): - """The error detail. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.resourcemanager.largeheader.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.resourcemanager.largeheader.models.ErrorAdditionalInfo] - """ - - code: str - """The error code.""" - message: str - """The error message.""" - target: str - """The error target.""" - details: list["ErrorDetail"] - """The error details.""" - additionalInfo: list["ErrorAdditionalInfo"] - """The error additional info.""" - - -class ErrorResponse(TypedDict, total=False): - """Error response. - - :ivar error: The error object. - :vartype error: ~azure.resourcemanager.largeheader.models.ErrorDetail - """ - - error: "ErrorDetail" - """The error object.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/types.py deleted file mode 100644 index c60dcd94af68..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/types.py +++ /dev/null @@ -1,418 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import ActionType, CreatedByType, Origin, ResourceProvisioningState - - -class ErrorAdditionalInfo(TypedDict, total=False): - """The resource management error additional info. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: str - """The additional info type.""" - info: Any - """The additional info.""" - - -class ErrorDetail(TypedDict, total=False): - """The error detail. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.resourcemanager.methodsubscriptionid.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.resourcemanager.methodsubscriptionid.models.ErrorAdditionalInfo] - """ - - code: str - """The error code.""" - message: str - """The error message.""" - target: str - """The error target.""" - details: list["ErrorDetail"] - """The error details.""" - additionalInfo: list["ErrorAdditionalInfo"] - """The error additional info.""" - - -class ErrorResponse(TypedDict, total=False): - """Error response. - - :ivar error: The error object. - :vartype error: ~azure.resourcemanager.methodsubscriptionid.models.ErrorDetail - """ - - error: "ErrorDetail" - """The error object.""" - - -class Operation(TypedDict, total=False): - """REST API Operation. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for Azure Resource Manager/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.resourcemanager.methodsubscriptionid.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.resourcemanager.methodsubscriptionid.models.Origin - :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions - that are for internal only APIs. "Internal" - :vartype action_type: str or ~azure.resourcemanager.methodsubscriptionid.models.ActionType - """ - - name: str - """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - \"Microsoft.Compute/virtualMachines/write\", - \"Microsoft.Compute/virtualMachines/capture/action\".""" - isDataAction: bool - """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and - \"false\" for Azure Resource Manager/control-plane operations.""" - display: "OperationDisplay" - """Localized display information for this particular operation.""" - origin: Union[str, "Origin"] - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and - \"user,system\".""" - actionType: Union[str, "ActionType"] - """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for - internal only APIs. \"Internal\"""" - - -class OperationDisplay(TypedDict, total=False): - """Localized display information for an operation. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - provider: str - """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring - Insights\" or \"Microsoft Compute\".""" - resource: str - """The localized friendly name of the resource type related to this operation. E.g. \"Virtual - Machines\" or \"Job Schedule Collections\".""" - operation: str - """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create - or Update Virtual Machine\", \"Restart Virtual Machine\".""" - description: str - """The short, localized friendly description of the operation; suitable for tool tips and detailed - views.""" - - -class Resource(TypedDict, total=False): - """Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.methodsubscriptionid.models.SystemData - """ - - id: str - """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" - name: str - """The name of the resource.""" - type: str - """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or - \"Microsoft.Storage/storageAccounts\".""" - systemData: "SystemData" - """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" - - -class ProxyResource(Resource): - """Proxy Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.methodsubscriptionid.models.SystemData - """ - - -class TrackedResource(Resource): - """Tracked Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.methodsubscriptionid.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - tags: dict[str, str] - """Resource tags.""" - location: Required[str] - """The geo-location where the resource lives. Required.""" - - -class ResourceGroupResource(TrackedResource): - """Concrete tracked resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.methodsubscriptionid.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties - """ - - properties: "ResourceGroupResourceProperties" - """The resource-specific properties for this resource.""" - - -class ResourceGroupResourceProperties(TypedDict, total=False): - """Properties of resource group resource. - - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.resourcemanager.methodsubscriptionid.models.ResourceProvisioningState - :ivar resource_group_setting: The resource group-scoped setting. - :vartype resource_group_setting: str - """ - - provisioningState: Union[str, "ResourceProvisioningState"] - """The status of the last operation. Known values are: \"Succeeded\", \"Failed\", and - \"Canceled\".""" - resourceGroupSetting: str - """The resource group-scoped setting.""" - - -class SubscriptionResource(ProxyResource): - """Concrete proxy resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.methodsubscriptionid.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties - """ - - properties: "SubscriptionResourceProperties" - """The resource-specific properties for this resource.""" - - -class SubscriptionResource1(ProxyResource): - """Concrete proxy resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.methodsubscriptionid.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties - """ - - properties: "SubscriptionResource1Properties" - """The resource-specific properties for this resource.""" - - -class SubscriptionResource1Properties(TypedDict, total=False): - """Properties of subscription resource 1. - - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.resourcemanager.methodsubscriptionid.models.ResourceProvisioningState - :ivar description: The description of the resource. - :vartype description: str - """ - - provisioningState: Union[str, "ResourceProvisioningState"] - """The status of the last operation. Known values are: \"Succeeded\", \"Failed\", and - \"Canceled\".""" - description: str - """The description of the resource.""" - - -class SubscriptionResource2(ProxyResource): - """Concrete proxy resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.methodsubscriptionid.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties - """ - - properties: "SubscriptionResource2Properties" - """The resource-specific properties for this resource.""" - - -class SubscriptionResource2Properties(TypedDict, total=False): - """Properties of subscription resource 2. - - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.resourcemanager.methodsubscriptionid.models.ResourceProvisioningState - :ivar config_value: The configuration value. - :vartype config_value: str - """ - - provisioningState: Union[str, "ResourceProvisioningState"] - """The status of the last operation. Known values are: \"Succeeded\", \"Failed\", and - \"Canceled\".""" - configValue: str - """The configuration value.""" - - -class SubscriptionResourceProperties(TypedDict, total=False): - """Properties of subscription resource. - - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.resourcemanager.methodsubscriptionid.models.ResourceProvisioningState - :ivar subscription_setting: The subscription-scoped setting. - :vartype subscription_setting: str - """ - - provisioningState: Union[str, "ResourceProvisioningState"] - """The status of the last operation. Known values are: \"Succeeded\", \"Failed\", and - \"Canceled\".""" - subscriptionSetting: str - """The subscription-scoped setting.""" - - -class SystemData(TypedDict, total=False): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.resourcemanager.methodsubscriptionid.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.resourcemanager.methodsubscriptionid.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - createdBy: str - """The identity that created the resource.""" - createdByType: Union[str, "CreatedByType"] - """The type of identity that created the resource. Known values are: \"User\", \"Application\", - \"ManagedIdentity\", and \"Key\".""" - createdAt: datetime.datetime - """The timestamp of resource creation (UTC).""" - lastModifiedBy: str - """The identity that last modified the resource.""" - lastModifiedByType: Union[str, "CreatedByType"] - """The type of identity that last modified the resource. Known values are: \"User\", - \"Application\", \"ManagedIdentity\", and \"Key\".""" - lastModifiedAt: datetime.datetime - """The timestamp of resource last modification (UTC).""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/types.py deleted file mode 100644 index 098ed04bc6b4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/types.py +++ /dev/null @@ -1,272 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import CreatedByType, ResourceProvisioningState - - -class ErrorAdditionalInfo(TypedDict, total=False): - """The resource management error additional info. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: str - """The additional info type.""" - info: Any - """The additional info.""" - - -class ErrorDetail(TypedDict, total=False): - """The error detail. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.resourcemanager.multiservicesharedmodels.combined.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.resourcemanager.multiservicesharedmodels.combined.models.ErrorAdditionalInfo] - """ - - code: str - """The error code.""" - message: str - """The error message.""" - target: str - """The error target.""" - details: list["ErrorDetail"] - """The error details.""" - additionalInfo: list["ErrorAdditionalInfo"] - """The error additional info.""" - - -class ErrorResponse(TypedDict, total=False): - """Error response. - - :ivar error: The error object. - :vartype error: ~azure.resourcemanager.multiservicesharedmodels.combined.models.ErrorDetail - """ - - error: "ErrorDetail" - """The error object.""" - - -class Resource(TypedDict, total=False): - """Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: - ~azure.resourcemanager.multiservicesharedmodels.combined.models.SystemData - """ - - id: str - """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" - name: str - """The name of the resource.""" - type: str - """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or - \"Microsoft.Storage/storageAccounts\".""" - systemData: "SystemData" - """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" - - -class SharedMetadata(TypedDict, total=False): - """Common metadata shared across multiple services. - - :ivar created_at: Creation timestamp of the resource. - :vartype created_at: ~datetime.datetime - :ivar created_by: Creator of the resource. - :vartype created_by: str - :ivar tags: Tags associated with the resource. - :vartype tags: dict[str, str] - """ - - createdAt: datetime.datetime - """Creation timestamp of the resource.""" - createdBy: str - """Creator of the resource.""" - tags: dict[str, str] - """Tags associated with the resource.""" - - -class TrackedResource(Resource): - """Tracked Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: - ~azure.resourcemanager.multiservicesharedmodels.combined.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - tags: dict[str, str] - """Resource tags.""" - location: Required[str] - """The geo-location where the resource lives. Required.""" - - -class StorageAccount(TrackedResource): - """Storage account resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: - ~azure.resourcemanager.multiservicesharedmodels.combined.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.resourcemanager.multiservicesharedmodels.combined.models.StorageAccountProperties - """ - - properties: "StorageAccountProperties" - """The resource-specific properties for this resource.""" - - -class StorageAccountProperties(TypedDict, total=False): - """Storage account properties. - - :ivar provisioning_state: Known values are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.resourcemanager.multiservicesharedmodels.combined.models.ResourceProvisioningState - :ivar metadata: Shared metadata for the storage account. - :vartype metadata: - ~azure.resourcemanager.multiservicesharedmodels.combined.models.SharedMetadata - """ - - provisioningState: Union[str, "ResourceProvisioningState"] - """Known values are: \"Succeeded\", \"Failed\", and \"Canceled\".""" - metadata: "SharedMetadata" - """Shared metadata for the storage account.""" - - -class SystemData(TypedDict, total=False): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.resourcemanager.multiservicesharedmodels.combined.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.resourcemanager.multiservicesharedmodels.combined.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - createdBy: str - """The identity that created the resource.""" - createdByType: Union[str, "CreatedByType"] - """The type of identity that created the resource. Known values are: \"User\", \"Application\", - \"ManagedIdentity\", and \"Key\".""" - createdAt: datetime.datetime - """The timestamp of resource creation (UTC).""" - lastModifiedBy: str - """The identity that last modified the resource.""" - lastModifiedByType: Union[str, "CreatedByType"] - """The type of identity that last modified the resource. Known values are: \"User\", - \"Application\", \"ManagedIdentity\", and \"Key\".""" - lastModifiedAt: datetime.datetime - """The timestamp of resource last modification (UTC).""" - - -class VirtualMachine(TrackedResource): - """Describes a Virtual Machine. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: - ~azure.resourcemanager.multiservicesharedmodels.combined.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.resourcemanager.multiservicesharedmodels.combined.models.VirtualMachineProperties - """ - - properties: "VirtualMachineProperties" - """The resource-specific properties for this resource.""" - - -class VirtualMachineProperties(TypedDict, total=False): - """VirtualMachineProperties. - - :ivar provisioning_state: Known values are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.resourcemanager.multiservicesharedmodels.combined.models.ResourceProvisioningState - :ivar metadata: Shared metadata for the virtual machine. - :vartype metadata: - ~azure.resourcemanager.multiservicesharedmodels.combined.models.SharedMetadata - """ - - provisioningState: Union[str, "ResourceProvisioningState"] - """Known values are: \"Succeeded\", \"Failed\", and \"Canceled\".""" - metadata: "SharedMetadata" - """Shared metadata for the virtual machine.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/types.py deleted file mode 100644 index 4f1670b25dbb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/types.py +++ /dev/null @@ -1,237 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import CreatedByType, ResourceProvisioningState - - -class Resource(TypedDict, total=False): - """Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.multiservice.combined.models.SystemData - """ - - id: str - """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" - name: str - """The name of the resource.""" - type: str - """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or - \"Microsoft.Storage/storageAccounts\".""" - systemData: "SystemData" - """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" - - -class TrackedResource(Resource): - """Tracked Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.multiservice.combined.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - tags: dict[str, str] - """Resource tags.""" - location: Required[str] - """The geo-location where the resource lives. Required.""" - - -class Disk(TrackedResource): - """Disk resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.multiservice.combined.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.resourcemanager.multiservice.combined.models.DiskProperties - """ - - properties: "DiskProperties" - """The resource-specific properties for this resource.""" - - -class DiskProperties(TypedDict, total=False): - """Disk resource properties. - - :ivar provisioning_state: Known values are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.resourcemanager.multiservice.combined.models.ResourceProvisioningState - """ - - provisioningState: Union[str, "ResourceProvisioningState"] - """Known values are: \"Succeeded\", \"Failed\", and \"Canceled\".""" - - -class ErrorAdditionalInfo(TypedDict, total=False): - """The resource management error additional info. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: str - """The additional info type.""" - info: Any - """The additional info.""" - - -class ErrorDetail(TypedDict, total=False): - """The error detail. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.resourcemanager.multiservice.combined.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.resourcemanager.multiservice.combined.models.ErrorAdditionalInfo] - """ - - code: str - """The error code.""" - message: str - """The error message.""" - target: str - """The error target.""" - details: list["ErrorDetail"] - """The error details.""" - additionalInfo: list["ErrorAdditionalInfo"] - """The error additional info.""" - - -class ErrorResponse(TypedDict, total=False): - """Error response. - - :ivar error: The error object. - :vartype error: ~azure.resourcemanager.multiservice.combined.models.ErrorDetail - """ - - error: "ErrorDetail" - """The error object.""" - - -class SystemData(TypedDict, total=False): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.resourcemanager.multiservice.combined.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.resourcemanager.multiservice.combined.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - createdBy: str - """The identity that created the resource.""" - createdByType: Union[str, "CreatedByType"] - """The type of identity that created the resource. Known values are: \"User\", \"Application\", - \"ManagedIdentity\", and \"Key\".""" - createdAt: datetime.datetime - """The timestamp of resource creation (UTC).""" - lastModifiedBy: str - """The identity that last modified the resource.""" - lastModifiedByType: Union[str, "CreatedByType"] - """The type of identity that last modified the resource. Known values are: \"User\", - \"Application\", \"ManagedIdentity\", and \"Key\".""" - lastModifiedAt: datetime.datetime - """The timestamp of resource last modification (UTC).""" - - -class VirtualMachine(TrackedResource): - """Describes a Virtual Machine. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.multiservice.combined.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties - """ - - properties: "VirtualMachineProperties" - """The resource-specific properties for this resource.""" - - -class VirtualMachineProperties(TypedDict, total=False): - """VirtualMachineProperties. - - :ivar provisioning_state: Known values are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.resourcemanager.multiservice.combined.models.ResourceProvisioningState - """ - - provisioningState: Union[str, "ResourceProvisioningState"] - """Known values are: \"Succeeded\", \"Failed\", and \"Canceled\".""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/types.py deleted file mode 100644 index fa7328667dc4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/types.py +++ /dev/null @@ -1,83 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any -from typing_extensions import TypedDict - - -class ErrorAdditionalInfo(TypedDict, total=False): - """The resource management error additional info. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: str - """The additional info type.""" - info: Any - """The additional info.""" - - -class ErrorDetail(TypedDict, total=False): - """The error detail. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.resourcemanager.nonresource.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.resourcemanager.nonresource.models.ErrorAdditionalInfo] - """ - - code: str - """The error code.""" - message: str - """The error message.""" - target: str - """The error target.""" - details: list["ErrorDetail"] - """The error details.""" - additionalInfo: list["ErrorAdditionalInfo"] - """The error additional info.""" - - -class ErrorResponse(TypedDict, total=False): - """Error response. - - :ivar error: The error object. - :vartype error: ~azure.resourcemanager.nonresource.models.ErrorDetail - """ - - error: "ErrorDetail" - """The error object.""" - - -class NonResource(TypedDict, total=False): - """Though this model has ``id``, ``name``, ``type`` properties, it is not a resource as it doesn't - extends ``Resource``. - - :ivar id: An id. - :vartype id: str - :ivar name: A name. - :vartype name: str - :ivar type: A type. - :vartype type: str - """ - - id: str - """An id.""" - name: str - """A name.""" - type: str - """A type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/types.py deleted file mode 100644 index 8dd0cca86f50..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/types.py +++ /dev/null @@ -1,477 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import ActionType, CheckNameAvailabilityReason, CreatedByType, Origin - - -class ActionRequest(TypedDict, total=False): - """ActionRequest. - - :ivar action_type: The action type to perform. - :vartype action_type: str - :ivar parameters: Additional action parameters. - :vartype parameters: str - """ - - actionType: str - """The action type to perform.""" - parameters: str - """Additional action parameters.""" - - -class ActionResult(TypedDict, total=False): - """ActionResult. - - :ivar result: The result of the action. Required. - :vartype result: str - """ - - result: Required[str] - """The result of the action. Required.""" - - -class ChangeAllowanceRequest(TypedDict, total=False): - """ChangeAllowanceRequest. - - :ivar total_allowed: The new total allowed widgets. - :vartype total_allowed: int - :ivar reason: The reason for the change. - :vartype reason: str - """ - - totalAllowed: int - """The new total allowed widgets.""" - reason: str - """The reason for the change.""" - - -class ChangeAllowanceResult(TypedDict, total=False): - """ChangeAllowanceResult. - - :ivar total_allowed: The new total allowed widgets. Required. - :vartype total_allowed: int - :ivar status: The status of the change. Required. - :vartype status: str - """ - - totalAllowed: Required[int] - """The new total allowed widgets. Required.""" - status: Required[str] - """The status of the change. Required.""" - - -class CheckNameAvailabilityRequest(TypedDict, total=False): - """The check availability request body. - - :ivar name: The name of the resource for which availability needs to be checked. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - """ - - name: str - """The name of the resource for which availability needs to be checked.""" - type: str - """The resource type.""" - - -class CheckNameAvailabilityResponse(TypedDict, total=False): - """The check availability result. - - :ivar name_available: Indicates if the resource name is available. - :vartype name_available: bool - :ivar reason: The reason why the given name is not available. Known values are: "Invalid" and - "AlreadyExists". - :vartype reason: str or - ~azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason - :ivar message: Detailed reason why the given name is not available. - :vartype message: str - """ - - nameAvailable: bool - """Indicates if the resource name is available.""" - reason: Union[str, "CheckNameAvailabilityReason"] - """The reason why the given name is not available. Known values are: \"Invalid\" and - \"AlreadyExists\".""" - message: str - """Detailed reason why the given name is not available.""" - - -class ErrorAdditionalInfo(TypedDict, total=False): - """The resource management error additional info. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: str - """The additional info type.""" - info: Any - """The additional info.""" - - -class ErrorDetail(TypedDict, total=False): - """The error detail. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.resourcemanager.operationtemplates.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.resourcemanager.operationtemplates.models.ErrorAdditionalInfo] - """ - - code: str - """The error code.""" - message: str - """The error message.""" - target: str - """The error target.""" - details: list["ErrorDetail"] - """The error details.""" - additionalInfo: list["ErrorAdditionalInfo"] - """The error additional info.""" - - -class ErrorResponse(TypedDict, total=False): - """Error response. - - :ivar error: The error object. - :vartype error: ~azure.resourcemanager.operationtemplates.models.ErrorDetail - """ - - error: "ErrorDetail" - """The error object.""" - - -class ExportRequest(TypedDict, total=False): - """ExportRequest. - - :ivar format: Format of the exported order. Required. - :vartype format: str - """ - - format: Required[str] - """Format of the exported order. Required.""" - - -class ExportResult(TypedDict, total=False): - """ExportResult. - - :ivar content: Content of the exported order. Required. - :vartype content: str - """ - - content: Required[str] - """Content of the exported order. Required.""" - - -class Operation(TypedDict, total=False): - """REST API Operation. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for Azure Resource Manager/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.resourcemanager.operationtemplates.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.resourcemanager.operationtemplates.models.Origin - :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions - that are for internal only APIs. "Internal" - :vartype action_type: str or ~azure.resourcemanager.operationtemplates.models.ActionType - """ - - name: str - """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - \"Microsoft.Compute/virtualMachines/write\", - \"Microsoft.Compute/virtualMachines/capture/action\".""" - isDataAction: bool - """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and - \"false\" for Azure Resource Manager/control-plane operations.""" - display: "OperationDisplay" - """Localized display information for this particular operation.""" - origin: Union[str, "Origin"] - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and - \"user,system\".""" - actionType: Union[str, "ActionType"] - """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for - internal only APIs. \"Internal\"""" - - -class OperationDisplay(TypedDict, total=False): - """Localized display information for an operation. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - provider: str - """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring - Insights\" or \"Microsoft Compute\".""" - resource: str - """The localized friendly name of the resource type related to this operation. E.g. \"Virtual - Machines\" or \"Job Schedule Collections\".""" - operation: str - """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create - or Update Virtual Machine\", \"Restart Virtual Machine\".""" - description: str - """The short, localized friendly description of the operation; suitable for tool tips and detailed - views.""" - - -class Resource(TypedDict, total=False): - """Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.operationtemplates.models.SystemData - """ - - id: str - """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" - name: str - """The name of the resource.""" - type: str - """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or - \"Microsoft.Storage/storageAccounts\".""" - systemData: "SystemData" - """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" - - -class TrackedResource(Resource): - """Tracked Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.operationtemplates.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - tags: dict[str, str] - """Resource tags.""" - location: Required[str] - """The geo-location where the resource lives. Required.""" - - -class Order(TrackedResource): - """Concrete tracked resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.operationtemplates.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.resourcemanager.operationtemplates.models.OrderProperties - """ - - properties: "OrderProperties" - """The resource-specific properties for this resource.""" - - -class OrderProperties(TypedDict, total=False): - """OrderProperties. - - :ivar product_id: The product ID of the order. Required. - :vartype product_id: str - :ivar amount: Amount of the product. Required. - :vartype amount: int - :ivar provisioning_state: The provisioning state of the product. - :vartype provisioning_state: str - """ - - productId: Required[str] - """The product ID of the order. Required.""" - amount: Required[int] - """Amount of the product. Required.""" - provisioningState: str - """The provisioning state of the product.""" - - -class Product(TrackedResource): - """Concrete tracked resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.operationtemplates.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.resourcemanager.operationtemplates.models.ProductProperties - """ - - properties: "ProductProperties" - """The resource-specific properties for this resource.""" - - -class ProductProperties(TypedDict, total=False): - """ProductProperties. - - :ivar product_id: The product ID. - :vartype product_id: str - :ivar provisioning_state: The provisioning state of the product. - :vartype provisioning_state: str - """ - - productId: str - """The product ID.""" - provisioningState: str - """The provisioning state of the product.""" - - -class SystemData(TypedDict, total=False): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.resourcemanager.operationtemplates.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.resourcemanager.operationtemplates.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - createdBy: str - """The identity that created the resource.""" - createdByType: Union[str, "CreatedByType"] - """The type of identity that created the resource. Known values are: \"User\", \"Application\", - \"ManagedIdentity\", and \"Key\".""" - createdAt: datetime.datetime - """The timestamp of resource creation (UTC).""" - lastModifiedBy: str - """The identity that last modified the resource.""" - lastModifiedByType: Union[str, "CreatedByType"] - """The type of identity that last modified the resource. Known values are: \"User\", - \"Application\", \"ManagedIdentity\", and \"Key\".""" - lastModifiedAt: datetime.datetime - """The timestamp of resource last modification (UTC).""" - - -class Widget(TrackedResource): - """Concrete tracked resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.operationtemplates.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.resourcemanager.operationtemplates.models.WidgetProperties - """ - - properties: "WidgetProperties" - """The resource-specific properties for this resource.""" - - -class WidgetProperties(TypedDict, total=False): - """WidgetProperties. - - :ivar name: The name of the widget. - :vartype name: str - :ivar description: The description of the widget. - :vartype description: str - :ivar provisioning_state: The provisioning state of the widget. - :vartype provisioning_state: str - """ - - name: str - """The name of the widget.""" - description: str - """The description of the widget.""" - provisioningState: str - """The provisioning state of the widget.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/types.py deleted file mode 100644 index f94ef595f7dd..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/types.py +++ /dev/null @@ -1,413 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import CreatedByType, ProvisioningState - - -class ErrorAdditionalInfo(TypedDict, total=False): - """The resource management error additional info. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: str - """The additional info type.""" - info: Any - """The additional info.""" - - -class ErrorDetail(TypedDict, total=False): - """The error detail. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.resourcemanager.resources.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.resourcemanager.resources.models.ErrorAdditionalInfo] - """ - - code: str - """The error code.""" - message: str - """The error message.""" - target: str - """The error target.""" - details: list["ErrorDetail"] - """The error details.""" - additionalInfo: list["ErrorAdditionalInfo"] - """The error additional info.""" - - -class ErrorResponse(TypedDict, total=False): - """Error response. - - :ivar error: The error object. - :vartype error: ~azure.resourcemanager.resources.models.ErrorDetail - """ - - error: "ErrorDetail" - """The error object.""" - - -class Resource(TypedDict, total=False): - """Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.resources.models.SystemData - """ - - id: str - """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" - name: str - """The name of the resource.""" - type: str - """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or - \"Microsoft.Storage/storageAccounts\".""" - systemData: "SystemData" - """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" - - -class ExtensionResource(Resource): - """The base extension resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.resources.models.SystemData - """ - - -class ExtensionsResource(ExtensionResource): - """Concrete extension resource types can be created by aliasing this type using a specific - property type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.resources.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.resourcemanager.resources.models.ExtensionsResourceProperties - """ - - properties: "ExtensionsResourceProperties" - """The resource-specific properties for this resource.""" - - -class ExtensionsResourceProperties(TypedDict, total=False): - """ExtensionsResource properties. - - :ivar description: The description of the resource. - :vartype description: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.resourcemanager.resources.models.ProvisioningState - """ - - description: str - """The description of the resource.""" - provisioningState: Union[str, "ProvisioningState"] - """The status of the last operation. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" - - -class ProxyResource(Resource): - """Proxy Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.resources.models.SystemData - """ - - -class LocationResource(ProxyResource): - """Concrete proxy resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.resources.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.resourcemanager.resources.models.LocationResourceProperties - """ - - properties: "LocationResourceProperties" - """The resource-specific properties for this resource.""" - - -class LocationResourceProperties(TypedDict, total=False): - """Location resource properties. - - :ivar description: The description of the resource. - :vartype description: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.resourcemanager.resources.models.ProvisioningState - """ - - description: str - """The description of the resource.""" - provisioningState: Union[str, "ProvisioningState"] - """The status of the last operation. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" - - -class NestedProxyResource(ProxyResource): - """Nested child of Top Level Tracked Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.resources.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.resourcemanager.resources.models.NestedProxyResourceProperties - """ - - properties: "NestedProxyResourceProperties" - """The resource-specific properties for this resource.""" - - -class NestedProxyResourceProperties(TypedDict, total=False): - """Nested Proxy Resource Properties. - - :ivar provisioning_state: Provisioning State of the nested child Resource. Known values are: - "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.resourcemanager.resources.models.ProvisioningState - :ivar description: Nested resource description. - :vartype description: str - """ - - provisioningState: Union[str, "ProvisioningState"] - """Provisioning State of the nested child Resource. Known values are: \"Succeeded\", \"Failed\", - \"Canceled\", \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" - description: str - """Nested resource description.""" - - -class NotificationDetails(TypedDict, total=False): - """The details of a user notification. - - :ivar message: The notification message. Required. - :vartype message: str - :ivar urgent: If true, the notification is urgent. Required. - :vartype urgent: bool - """ - - message: Required[str] - """The notification message. Required.""" - urgent: Required[bool] - """If true, the notification is urgent. Required.""" - - -class TrackedResource(Resource): - """Tracked Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.resources.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - tags: dict[str, str] - """Resource tags.""" - location: Required[str] - """The geo-location where the resource lives. Required.""" - - -class SingletonTrackedResource(TrackedResource): - """Concrete tracked resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.resources.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.resourcemanager.resources.models.SingletonTrackedResourceProperties - """ - - properties: "SingletonTrackedResourceProperties" - """The resource-specific properties for this resource.""" - - -class SingletonTrackedResourceProperties(TypedDict, total=False): - """Singleton Arm Resource Properties. - - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.resourcemanager.resources.models.ProvisioningState - :ivar description: The description of the resource. - :vartype description: str - """ - - provisioningState: Union[str, "ProvisioningState"] - """The status of the last operation. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" - description: str - """The description of the resource.""" - - -class SystemData(TypedDict, total=False): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.resourcemanager.resources.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.resourcemanager.resources.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - createdBy: str - """The identity that created the resource.""" - createdByType: Union[str, "CreatedByType"] - """The type of identity that created the resource. Known values are: \"User\", \"Application\", - \"ManagedIdentity\", and \"Key\".""" - createdAt: datetime.datetime - """The timestamp of resource creation (UTC).""" - lastModifiedBy: str - """The identity that last modified the resource.""" - lastModifiedByType: Union[str, "CreatedByType"] - """The type of identity that last modified the resource. Known values are: \"User\", - \"Application\", \"ManagedIdentity\", and \"Key\".""" - lastModifiedAt: datetime.datetime - """The timestamp of resource last modification (UTC).""" - - -class TopLevelTrackedResource(TrackedResource): - """Concrete tracked resource types can be created by aliasing this type using a specific property - type. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.resourcemanager.resources.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties - """ - - properties: "TopLevelTrackedResourceProperties" - """The resource-specific properties for this resource.""" - - -class TopLevelTrackedResourceProperties(TypedDict, total=False): - """Top Level Arm Resource Properties. - - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.resourcemanager.resources.models.ProvisioningState - :ivar description: The description of the resource. - :vartype description: str - """ - - provisioningState: Union[str, "ProvisioningState"] - """The status of the last operation. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" - description: str - """The description of the resource.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-special-headers-conditional-request/azure/specialheaders/conditionalrequest/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/types.py deleted file mode 100644 index 5660f445edbd..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/types.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class ListWidgetsResponse(TypedDict, total=False): - """ListWidgetsResponse. - - :ivar widgets: Required. - :vartype widgets: list[~specs.azure.versioning.previewversion.models.Widget] - """ - - widgets: Required[list["Widget"]] - """Required.""" - - -class UpdateWidgetColorRequest(TypedDict, total=False): - """Update widget color request. - - :ivar color: New color for the widget. Required. - :vartype color: str - """ - - color: Required[str] - """New color for the widget. Required.""" - - -class Widget(TypedDict, total=False): - """A simple model for testing. - - :ivar id: Widget identifier. Required. - :vartype id: str - :ivar name: Widget name. Required. - :vartype name: str - :ivar color: Widget color, only available in preview version. - :vartype color: str - """ - - id: Required[str] - """Widget identifier. Required.""" - name: Required[str] - """Widget name. Required.""" - color: str - """Widget color, only available in preview version.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/first/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/first/types.py deleted file mode 100644 index 52f34644d3eb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/first/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class FirstClientResult(TypedDict, total=False): - """FirstClientResult. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/types.py deleted file mode 100644 index ecad43683d2a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-namespace/client/clientnamespace/second/types.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .submodels import SecondClientEnumType - - -class SecondClientResult(TypedDict, total=False): - """SecondClientResult. - - :ivar type: Required. "second" - :vartype type: str or ~client.clientnamespace.second.sub.models.SecondClientEnumType - """ - - type: Required[Union[str, "SecondClientEnumType"]] - """Required. \"second\"""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/types.py deleted file mode 100644 index a699daabd830..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/types.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import Status - - -class FirstModel(TypedDict, total=False): - """FirstModel. - - :ivar status: Status from first namespace. Required. Known values are: "active" and "inactive". - :vartype status: str or ~client.naming.enumconflict.firstnamespace.models.Status - :ivar name: Name of the item. Required. - :vartype name: str - """ - - status: Required[Union[str, "Status"]] - """Status from first namespace. Required. Known values are: \"active\" and \"inactive\".""" - name: Required[str] - """Name of the item. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/types.py deleted file mode 100644 index 0db965a61148..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/types.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import SecondStatus - - -class SecondModel(TypedDict, total=False): - """SecondModel. - - :ivar status: Status from second namespace. Required. Known values are: "running" and - "stopped". - :vartype status: str or ~client.naming.enumconflict.secondnamespace.models.SecondStatus - :ivar description: Description of the item. Required. - :vartype description: str - """ - - status: Required[Union[str, "SecondStatus"]] - """Status from second namespace. Required. Known values are: \"running\" and \"stopped\".""" - description: Required[str] - """Description of the item. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/CHANGELOG.md deleted file mode 100644 index b957b2575b48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release History - -## 1.0.0b1 (1970-01-01) - -### Other Changes - - - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/LICENSE b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/LICENSE deleted file mode 100644 index 63447fd8bbbf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/MANIFEST.in b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/MANIFEST.in deleted file mode 100644 index af0a4c71bdcd..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include *.md -include LICENSE -include client/naming/typeddict/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include client/__init__.py -include client/naming/__init__.py diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/_metadata.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/_metadata.json deleted file mode 100644 index 49515fdbafdf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/_metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "apiVersions": {} -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/apiview-properties.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/apiview-properties.json deleted file mode 100644 index 660f9d127435..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/apiview-properties.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "CrossLanguagePackageId": "Client.Naming", - "CrossLanguageDefinitionId": { - "client.naming.typeddict.models.ClientModel": "Client.Naming.Model.ModelWithClientClientName", - "client.naming.typeddict.models.ClientNameAndJsonEncodedNameModel": "Client.Naming.Property.ClientNameAndJsonEncodedNameModel", - "client.naming.typeddict.models.ClientNameModel": "Client.Naming.Property.ClientNameModel", - "client.naming.typeddict.models.LanguageClientNameModel": "Client.Naming.Property.LanguageClientNameModel", - "client.naming.typeddict.models.PythonModel": "Client.Naming.Model.ModelWithLanguageClientName", - "client.naming.typeddict.models.ClientExtensibleEnum": "Client.Naming.UnionEnum.ServerExtensibleEnum", - "client.naming.typeddict.models.ExtensibleEnum": "Client.Naming.UnionEnum.ExtensibleEnum", - "client.naming.typeddict.operations.PropertyOperations.client": "Client.Naming.Property.client", - "client.naming.typeddict.aio.operations.PropertyOperations.client": "Client.Naming.Property.client", - "client.naming.typeddict.operations.PropertyOperations.language": "Client.Naming.Property.language", - "client.naming.typeddict.aio.operations.PropertyOperations.language": "Client.Naming.Property.language", - "client.naming.typeddict.operations.PropertyOperations.compatible_with_encoded_name": "Client.Naming.Property.compatibleWithEncodedName", - "client.naming.typeddict.aio.operations.PropertyOperations.compatible_with_encoded_name": "Client.Naming.Property.compatibleWithEncodedName", - "client.naming.typeddict.operations.HeaderOperations.request": "Client.Naming.Header.request", - "client.naming.typeddict.aio.operations.HeaderOperations.request": "Client.Naming.Header.request", - "client.naming.typeddict.operations.HeaderOperations.response": "Client.Naming.Header.response", - "client.naming.typeddict.aio.operations.HeaderOperations.response": "Client.Naming.Header.response", - "client.naming.typeddict.operations.ModelClientOperations.client": "Client.Naming.Model.client", - "client.naming.typeddict.aio.operations.ModelClientOperations.client": "Client.Naming.Model.client", - "client.naming.typeddict.operations.ModelClientOperations.language": "Client.Naming.Model.language", - "client.naming.typeddict.aio.operations.ModelClientOperations.language": "Client.Naming.Model.language", - "client.naming.typeddict.operations.UnionEnumOperations.union_enum_name": "Client.Naming.UnionEnum.unionEnumName", - "client.naming.typeddict.aio.operations.UnionEnumOperations.union_enum_name": "Client.Naming.UnionEnum.unionEnumName", - "client.naming.typeddict.operations.UnionEnumOperations.union_enum_member_name": "Client.Naming.UnionEnum.unionEnumMemberName", - "client.naming.typeddict.aio.operations.UnionEnumOperations.union_enum_member_name": "Client.Naming.UnionEnum.unionEnumMemberName", - "client.naming.typeddict.NamingClient.client_name": "Client.Naming.operation", - "client.naming.typeddict.aio.NamingClient.client_name": "Client.Naming.operation", - "client.naming.typeddict.NamingClient.parameter": "Client.Naming.parameter", - "client.naming.typeddict.aio.NamingClient.parameter": "Client.Naming.parameter" - }, - "CrossLanguageVersion": "75e5b1ae7e7f" -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/__init__.py deleted file mode 100644 index dd86870d8cdd..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import NamingClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "NamingClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_client.py deleted file mode 100644 index 66e77b124ae7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_client.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -import sys -from typing import Any - -from azure.core import PipelineClient -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse - -from ._configuration import NamingClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import ( - HeaderOperations, - ModelClientOperations, - PropertyOperations, - UnionEnumOperations, - _NamingClientOperationsMixin, -) - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class NamingClient(_NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Describe changing names of types in a client with ``@clientName``. - - :ivar property: PropertyOperations operations - :vartype property: client.naming.typeddict.operations.PropertyOperations - :ivar header: HeaderOperations operations - :vartype header: client.naming.typeddict.operations.HeaderOperations - :ivar model_client: ModelClientOperations operations - :vartype model_client: client.naming.typeddict.operations.ModelClientOperations - :ivar union_enum: UnionEnumOperations operations - :vartype union_enum: client.naming.typeddict.operations.UnionEnumOperations - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = NamingClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - self.property = PropertyOperations(self._client, self._config, self._serialize, self._deserialize) - self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) - self.model_client = ModelClientOperations(self._client, self._config, self._serialize, self._deserialize) - self.union_enum = UnionEnumOperations(self._client, self._config, self._serialize, self._deserialize) - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_configuration.py deleted file mode 100644 index e532f883b819..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from ._version import VERSION - - -class NamingClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for NamingClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "client-naming-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/__init__.py deleted file mode 100644 index 8026245c2abc..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/model_base.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/model_base.py deleted file mode 100644 index d725c55906d3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/model_base.py +++ /dev/null @@ -1,1737 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=protected-access, broad-except - -import copy -import calendar -import decimal -import functools -import sys -import logging -import base64 -import re -import typing -import enum -import email.utils -from datetime import datetime, date, time, timedelta, timezone -from json import JSONEncoder -import xml.etree.ElementTree as ET -from collections.abc import MutableMapping -import isodate -from azure.core.exceptions import DeserializationError -from azure.core import CaseInsensitiveEnumMeta -from azure.core.pipeline import PipelineResponse -from azure.core.serialization import _Null - -from azure.core.rest import HttpResponse - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_LOGGER = logging.getLogger(__name__) - -__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] - -TZ_UTC = timezone.utc -_T = typing.TypeVar("_T") -_NONE_TYPE = type(None) - - -def _timedelta_as_isostr(td: timedelta) -> str: - """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' - - Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython - - :param timedelta td: The timedelta to convert - :rtype: str - :return: ISO8601 version of this timedelta - """ - - # Split seconds to larger units - seconds = td.total_seconds() - minutes, seconds = divmod(seconds, 60) - hours, minutes = divmod(minutes, 60) - days, hours = divmod(hours, 24) - - days, hours, minutes = list(map(int, (days, hours, minutes))) - seconds = round(seconds, 6) - - # Build date - date_str = "" - if days: - date_str = "%sD" % days - - if hours or minutes or seconds: - # Build time - time_str = "T" - - # Hours - bigger_exists = date_str or hours - if bigger_exists: - time_str += "{:02}H".format(hours) - - # Minutes - bigger_exists = bigger_exists or minutes - if bigger_exists: - time_str += "{:02}M".format(minutes) - - # Seconds - try: - if seconds.is_integer(): - seconds_string = "{:02}".format(int(seconds)) - else: - # 9 chars long w/ leading 0, 6 digits after decimal - seconds_string = "%09.6f" % seconds - # Remove trailing zeros - seconds_string = seconds_string.rstrip("0") - except AttributeError: # int.is_integer() raises - seconds_string = "{:02}".format(seconds) - - time_str += "{}S".format(seconds_string) - else: - time_str = "" - - return "P" + date_str + time_str - - -def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: - encoded = base64.b64encode(o).decode() - if format == "base64url": - return encoded.strip("=").replace("+", "-").replace("/", "_") - return encoded - - -def _serialize_datetime(o, format: typing.Optional[str] = None): - if hasattr(o, "year") and hasattr(o, "hour"): - if format == "rfc7231": - return email.utils.format_datetime(o, usegmt=True) - if format == "unix-timestamp": - return int(calendar.timegm(o.utctimetuple())) - - # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) - if not o.tzinfo: - iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() - else: - iso_formatted = o.astimezone(TZ_UTC).isoformat() - # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) - return iso_formatted.replace("+00:00", "Z") - # Next try datetime.date or datetime.time - return o.isoformat() - - -def _is_readonly(p): - try: - return p._visibility == ["read"] - except AttributeError: - return False - - -class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" - - def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): - super().__init__(*args, **kwargs) - self.exclude_readonly = exclude_readonly - self.format = format - - def default(self, o): # pylint: disable=too-many-return-statements - if _is_model(o): - if self.exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - return {k: v for k, v in o.items() if k not in readonly_props} - return dict(o.items()) - try: - return super(SdkJSONEncoder, self).default(o) - except TypeError: - if isinstance(o, _Null): - return None - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, self.format) - try: - # First try datetime.datetime - return _serialize_datetime(o, self.format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return super(SdkJSONEncoder, self).default(o) - - -_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") -_VALID_RFC7231 = re.compile( - r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" - r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" -) - -_ARRAY_ENCODE_MAPPING = { - "pipeDelimited": "|", - "spaceDelimited": " ", - "commaDelimited": ",", - "newlineDelimited": "\n", -} - - -def _deserialize_array_encoded(delimit: str, attr): - if isinstance(attr, str): - if attr == "": - return [] - return attr.split(delimit) - return attr - - -def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - attr = attr.upper() - match = _VALID_DATE.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - return date_obj # type: ignore[no-any-return] - - -def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize RFC7231 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - match = _VALID_RFC7231.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - return email.utils.parsedate_to_datetime(attr) - - -def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: - """Deserialize unix timestamp into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - return datetime.fromtimestamp(attr, TZ_UTC) - - -def _deserialize_date(attr: typing.Union[str, date]) -> date: - """Deserialize ISO-8601 formatted string into Date object. - :param str attr: response string to be deserialized. - :rtype: date - :returns: The date object from that input - """ - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - if isinstance(attr, date): - return attr - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore - - -def _deserialize_time(attr: typing.Union[str, time]) -> time: - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :returns: The time object from that input - """ - if isinstance(attr, time): - return attr - return isodate.parse_time(attr) # type: ignore[no-any-return] - - -def _deserialize_bytes(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - return bytes(base64.b64decode(attr)) - - -def _deserialize_bytes_base64(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return bytes(base64.b64decode(encoded)) - - -def _deserialize_duration(attr): - if isinstance(attr, timedelta): - return attr - return isodate.parse_duration(attr) - - -def _deserialize_decimal(attr): - if isinstance(attr, decimal.Decimal): - return attr - return decimal.Decimal(str(attr)) - - -def _deserialize_int_as_str(attr): - if isinstance(attr, int): - return attr - return int(attr) - - -_DESERIALIZE_MAPPING = { - datetime: _deserialize_datetime, - date: _deserialize_date, - time: _deserialize_time, - bytes: _deserialize_bytes, - bytearray: _deserialize_bytes, - timedelta: _deserialize_duration, - typing.Any: lambda x: x, - decimal.Decimal: _deserialize_decimal, -} - -_DESERIALIZE_MAPPING_WITHFORMAT = { - "rfc3339": _deserialize_datetime, - "rfc7231": _deserialize_datetime_rfc7231, - "unix-timestamp": _deserialize_datetime_unix_timestamp, - "base64": _deserialize_bytes, - "base64url": _deserialize_bytes_base64, -} - - -def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): - if annotation is int and rf and rf._format == "str": - return _deserialize_int_as_str - if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: - return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) - if rf and rf._format: - return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) - return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore - - -def _get_type_alias_type(module_name: str, alias_name: str): - types = { - k: v - for k, v in sys.modules[module_name].__dict__.items() - if isinstance(v, typing._GenericAlias) # type: ignore - } - if alias_name not in types: - return alias_name - return types[alias_name] - - -def _get_model(module_name: str, model_name: str): - models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} - module_end = module_name.rsplit(".", 1)[0] - models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) - if isinstance(model_name, str): - model_name = model_name.split(".")[-1] - if model_name not in models: - return model_name - return models[model_name] - - -_UNSET = object() - - -class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: dict[str, typing.Any]) -> None: - self._data = data - - def __contains__(self, key: typing.Any) -> bool: - return key in self._data - - def __getitem__(self, key: str) -> typing.Any: - # If this key has been deserialized (for mutable types), we need to handle serialization - if hasattr(self, "_attr_to_rest_field"): - cache_attr = f"_deserialized_{key}" - if hasattr(self, cache_attr): - rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) - if rf: - value = self._data.get(key) - if isinstance(value, (dict, list, set)): - # For mutable types, serialize and return - # But also update _data with serialized form and clear flag - # so mutations via this returned value affect _data - serialized = _serialize(value, rf._format) - # If serialized form is same type (no transformation needed), - # return _data directly so mutations work - if isinstance(serialized, type(value)) and serialized == value: - return self._data.get(key) - # Otherwise return serialized copy and clear flag - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - # Store serialized form back - self._data[key] = serialized - return serialized - return self._data.__getitem__(key) - - def __setitem__(self, key: str, value: typing.Any) -> None: - # Clear any cached deserialized value when setting through dictionary access - cache_attr = f"_deserialized_{key}" - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - self._data.__setitem__(key, value) - - def __delitem__(self, key: str) -> None: - self._data.__delitem__(key) - - def __iter__(self) -> typing.Iterator[typing.Any]: - return self._data.__iter__() - - def __len__(self) -> int: - return self._data.__len__() - - def __ne__(self, other: typing.Any) -> bool: - return not self.__eq__(other) - - def keys(self) -> typing.KeysView[str]: - """ - :returns: a set-like object providing a view on D's keys - :rtype: ~typing.KeysView - """ - return self._data.keys() - - def values(self) -> typing.ValuesView[typing.Any]: - """ - :returns: an object providing a view on D's values - :rtype: ~typing.ValuesView - """ - return self._data.values() - - def items(self) -> typing.ItemsView[str, typing.Any]: - """ - :returns: set-like object providing a view on D's items - :rtype: ~typing.ItemsView - """ - return self._data.items() - - def get(self, key: str, default: typing.Any = None) -> typing.Any: - """ - Get the value for key if key is in the dictionary, else default. - :param str key: The key to look up. - :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. - :rtype: any - """ - try: - return self[key] - except KeyError: - return default - - @typing.overload - def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ - - @typing.overload - def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs - - @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Removes specified key and return the corresponding value. - :param str key: The key to pop. - :param any default: The value to return if key is not in the dictionary - :returns: The value corresponding to the key. - :rtype: any - :raises KeyError: If key is not found and default is not given. - """ - if default is _UNSET: - return self._data.pop(key) - return self._data.pop(key, default) - - def popitem(self) -> tuple[str, typing.Any]: - """ - Removes and returns some (key, value) pair - :returns: The (key, value) pair. - :rtype: tuple - :raises KeyError: if D is empty. - """ - return self._data.popitem() - - def clear(self) -> None: - """ - Remove all items from D. - """ - self._data.clear() - - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ - """ - Updates D from mapping/iterable E and F. - :param any args: Either a mapping object or an iterable of key-value pairs. - """ - self._data.update(*args, **kwargs) - - @typing.overload - def setdefault(self, key: str, default: None = None) -> None: ... - - @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Same as calling D.get(k, d), and setting D[k]=d if k not found - :param str key: The key to look up. - :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. - :rtype: any - """ - if default is _UNSET: - return self._data.setdefault(key) - return self._data.setdefault(key, default) - - def __eq__(self, other: typing.Any) -> bool: - if isinstance(other, _MyMutableMapping): - return self._data == other._data - try: - other_model = self.__class__(other) - except Exception: - return False - return self._data == other_model._data - - def __repr__(self) -> str: - return str(self._data) - - -def _is_model(obj: typing.Any) -> bool: - return getattr(obj, "_is_model", False) - - -def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements - if isinstance(o, list): - if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): - return _ARRAY_ENCODE_MAPPING[format].join(o) - return [_serialize(x, format) for x in o] - if isinstance(o, dict): - return {k: _serialize(v, format) for k, v in o.items()} - if isinstance(o, set): - return {_serialize(x, format) for x in o} - if isinstance(o, tuple): - return tuple(_serialize(x, format) for x in o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, format) - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, enum.Enum): - return o.value - if isinstance(o, int): - if format == "str": - return str(o) - return o - try: - # First try datetime.datetime - return _serialize_datetime(o, format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return o - - -def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: - try: - return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) - except StopIteration: - return None - - -def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: - if not rf: - return _serialize(value, None) - if rf._is_multipart_file_input: - return value - if rf._is_model: - return _deserialize(rf._type, value) - if isinstance(value, ET.Element): - value = _deserialize(rf._type, value) - return _serialize(value, rf._format) - - -# ============================================================================ -# Fast-path scalar deserializer functions for rest_field(deserializer=...) -# These are referenced from rest_field declarations to bypass the generic -# _deserialize -> _deserialize_with_callable chain. -# Only simple/primitive types — no models or container types. -# ============================================================================ - - -def _xml_deser_str(value): - if isinstance(value, ET.Element): - return value.text or "" - return str(value) if value is not None else None - - -def _xml_deser_int(value): - if isinstance(value, ET.Element): - return int(value.text) if value.text else None - return int(value) if value is not None else None - - -def _xml_deser_float(value): - if isinstance(value, ET.Element): - return float(value.text) if value.text else None - return float(value) if value is not None else None - - -def _xml_deser_bool(value): - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - if text in (True, False): - return text - return text.lower() == "true" - - -# pylint: disable=docstring-missing-param -def _xml_deser_bytes(value): - """Deserialize bytes from XML (base64).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes(text) - - -def _xml_deser_bytes_base64url(value): - """Deserialize bytes from XML (base64url).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes_base64(text) - - -def _xml_deser_datetime(value): - """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime(text) - - -def _xml_deser_datetime_rfc7231(value): - """Deserialize a datetime from XML (RFC7231 format).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_rfc7231(text) - - -def _xml_deser_datetime_unix_timestamp(value): - """Deserialize a datetime from XML (Unix timestamp).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_unix_timestamp(float(text)) - - -def _xml_deser_date(value): - """Deserialize a date from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_date(text) - - -def _xml_deser_time(value): - """Deserialize a time from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_time(text) - - -def _xml_deser_duration(value): - """Deserialize a timedelta from XML (ISO 8601 duration).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_duration(text) - - -def _xml_deser_decimal(value): - """Deserialize a Decimal from XML.""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_decimal(text) - - -def _xml_deser_enum_or_str(enum_cls, value): - """Deserialize a Union[EnumType, str] from XML.""" - text = value.text if isinstance(value, ET.Element) else value - if text is None: - return None - try: - return enum_cls(text) - except ValueError: - return text - - -def _extract_xml_model_type(rf_type): - """Extract the concrete Model class from a resolved rf._type partial chain. - - Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` - wrappers. Only handles Model and Optional[Model] — other composite - types (List, Dict, Union, etc.) return None and fall through to the - generic ``_deserialize`` path at runtime. - """ - if rf_type is None: - return None - if isinstance(rf_type, type) and _is_model(rf_type): - return rf_type - if not isinstance(rf_type, functools.partial): - return None - func = rf_type.func - args = rf_type.args - if func is _deserialize_with_optional and args: - return _extract_xml_model_type(args[0]) - if func is _deserialize_model and args: - cls = args[0] - return cls if isinstance(cls, type) and _is_model(cls) else None - return None - - -def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable - cls, attr_to_rest_field: dict -) -> list: - """Build a precomputed XML field plan for fast _init_from_xml iteration. - - Called once per model class in __new__. Returns a list of tuples: - (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) - - kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text - - For Model and Optional[Model] fields that lack a scalar - ``_deserializer``, this function precomputes the Model class as the - deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` - directly instead of going through the expensive - ``_get_deserialize_callable_from_annotation`` chain at runtime. - """ - model_meta = getattr(cls, "_xml", {}) - model_ns = model_meta.get("ns") or model_meta.get("namespace") - plan = [] - - for rf in attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - deser = rf._deserializer - - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - is_optional = rf._is_optional - - # For Model / Optional[Model] fields without a scalar deserializer, - # precompute the Model class as the deserializer. - if deser is None and rf._type is not None: - model_cls = _extract_xml_model_type(rf._type) - if model_cls is not None: - deser = model_cls - - if prop_meta.get("attribute", False): - plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) - elif prop_meta.get("unwrapped", False): - items_name = prop_meta.get("itemsName") - if items_name: - items_ns = prop_meta.get("itemsNs") - if items_ns is not None: - xml_ns = items_ns - if xml_ns: - items_name = "{" + xml_ns + "}" + items_name - else: - items_name = xml_name - plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) - elif prop_meta.get("text", False): - plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) - else: - plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) - - return plan - - -# pylint: enable=docstring-missing-param -class Model(_MyMutableMapping): - _is_model = True - # label whether current class's _attr_to_rest_field has been calculated - # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: set[str] = set() - - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: - class_name = self.__class__.__name__ - if len(args) > 1: - raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass: dict[str, typing.Any] = {} - if args: - if isinstance(args[0], ET.Element): - dict_to_pass.update(self._init_from_xml(args[0])) - else: - dict_to_pass.update( - {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} - ) - else: - non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] - if non_attr_kwargs: - # actual type errors only throw the first wrong keyword arg they see, so following that. - raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") - dict_to_pass.update( - { - self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) - for k, v in kwargs.items() - if v is not None - } - ) - # Apply client default values for fields the caller didn't set so that - # defaults are part of `_data` and therefore included during serialization. - for rf in self._attr_to_rest_field.values(): - if rf._default is _UNSET: - continue - if rf._rest_name in dict_to_pass: - continue - dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) - super().__init__(dict_to_pass) - - def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements - self, element: ET.Element - ) -> dict[str, typing.Any]: - """Deserialize an XML element into a dict mapping rest field names to values. - - :param ET.Element element: The XML element to deserialize from. - :returns: A dictionary of rest_name to deserialized value pairs. - :rtype: dict - """ - result: dict[str, typing.Any] = {} - existed_attr_keys: list[str] = [] - - field_plan = getattr(self, "_xml_field_plan", None) - if field_plan: - for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: - if kind == 0: # wrapped element (most common) - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(item) - else: - result[rest_name] = _deserialize(rf_type, item) - elif kind == 1: # attribute - attr_val = element.get(xml_name) - if attr_val is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(attr_val) - else: - result[rest_name] = attr_val - elif kind == 2: # unwrapped array - items = element.findall(items_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(items_name) - if deser: - result[rest_name] = deser(items) - else: - result[rest_name] = _deserialize(rf_type, items) - elif not is_optional: - existed_attr_keys.append(items_name) - result[rest_name] = [] - elif kind == 3: # text - if element.text is not None: - if deser: - result[rest_name] = deser(element.text) - else: - result[rest_name] = element.text - else: - model_meta = getattr(self, "_xml", {}) - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in element: - if e.tag not in existed_attr_keys: - result[e.tag] = _convert_element(e) - - return result - - def copy(self) -> "Model": - return Model(self.__dict__) - - 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' - mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property - k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") - } - annotations = { - k: v - for mro_class in mros - 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__ - if not rf._type: - rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) - if not rf._rest_name_input: - rf._rest_name_input = attr - cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) - # Build XML field plan for fast _init_from_xml (only for XML models) - if getattr(cls, "_xml", None): - cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) - cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - - return super().__new__(cls) - - def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: - for base in cls.__bases__: - if hasattr(base, "__mapping__"): - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore - - @classmethod - def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: - for v in cls.__dict__.values(): - if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: - return v - return None - - @classmethod - def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): - return cls(data) - discriminator = cls._get_discriminator(exist_discriminators) - if discriminator is None: - return cls(data) - exist_discriminators.append(discriminator._rest_name) - if isinstance(data, ET.Element): - model_meta = getattr(cls, "_xml", {}) - prop_meta = getattr(discriminator, "_xml", {}) - xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - if data.get(xml_name) is not None: - discriminator_value = data.get(xml_name) - else: - 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 - return mapped_cls._deserialize(data, exist_discriminators) - - def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: - """Return a dict that can be turned into json using json.dump. - - :keyword bool exclude_readonly: Whether to remove the readonly properties. - :returns: A dict JSON compatible object - :rtype: dict - """ - - result = {} - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] - for k, v in self.items(): - if exclude_readonly and k in readonly_props: # pyright: ignore - continue - is_multipart_file_input = False - try: - is_multipart_file_input = next( - rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k - )._is_multipart_file_input - except StopIteration: - pass - result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) - return result - - @staticmethod - def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: - if v is None or isinstance(v, _Null): - return None - if isinstance(v, (list, tuple, set)): - return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) - if isinstance(v, dict): - return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} - return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v - - -def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - - -def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - -def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - - -def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj: dict[typing.Any, typing.Any], -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = {child.tag: child for child in obj} - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - - -def _deserialize_multiple_sequence( - entry_deserializers: list[typing.Optional[typing.Callable]], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) - - -def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: - return ( - isinstance(deserializer, functools.partial) - and isinstance(deserializer.args[0], functools.partial) - and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable - ) - - -def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = list(obj) - - # encoded string may be deserialized to sequence - if isinstance(obj, str) and isinstance(deserializer, functools.partial): - # for list[str] - if _is_array_encoded_deserializer(deserializer): - return deserializer(obj) - - # for list[Union[...]] - if isinstance(deserializer.args[0], list): - for sub_deserializer in deserializer.args[0]: - if _is_array_encoded_deserializer(sub_deserializer): - return sub_deserializer(obj) - - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - -def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: - return sorted( - types, - key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), - ) - - -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches - annotation: typing.Any, - module: typing.Optional[str], - rf: typing.Optional["_RestField"] = None, -) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - if not annotation: - return None - - # is it a type alias? - if isinstance(annotation, str): - if module is not None: - annotation = _get_type_alias_type(module, annotation) - - # is it a forward ref / in quotes? - if isinstance(annotation, (str, typing.ForwardRef)): - try: - model_name = annotation.__forward_arg__ # type: ignore - except AttributeError: - model_name = annotation - if module is not None: - annotation = _get_model(module, model_name) # type: ignore - - try: - if module and _is_model(annotation): - if rf: - rf._is_model = True - - return functools.partial(_deserialize_model, annotation) # pyright: ignore - except Exception: - pass - - # is it a literal? - try: - if annotation.__origin__ is typing.Literal: # pyright: ignore - return None - except AttributeError: - pass - - # is it optional? - try: - if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore - if rf: - rf._is_optional = True - if len(annotation.__args__) <= 2: # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) - # the type is Optional[Union[...]], we need to remove the None type from the Union - annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore - return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) - except AttributeError: - pass - - # is it union? - if getattr(annotation, "__origin__", None) is typing.Union: - # initial ordering is we make `string` the last deserialization option, because it is often them most generic - deserializers = [ - _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in _sorted_annotations(annotation.__args__) # pyright: ignore - ] - - return functools.partial(_deserialize_with_union, deserializers) - - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() == "dict": - value_deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[1], module, rf # pyright: ignore - ) - - return functools.partial( - _deserialize_dict, - value_deserializer, - module, - ) - except (AttributeError, IndexError): - pass - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: - if len(annotation.__args__) > 1: # pyright: ignore - entry_deserializers = [ - _get_deserialize_callable_from_annotation(dt, module, rf) - for dt in annotation.__args__ # pyright: ignore - ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) - deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[0], module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_sequence, deserializer, module) - except (TypeError, IndexError, AttributeError, SyntaxError): - pass - - def _deserialize_default( - deserializer, - obj, - ): - if obj is None: - return obj - try: - return _deserialize_with_callable(deserializer, obj) - except Exception: - pass - return obj - - if get_deserializer(annotation, rf): - return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) - - return functools.partial(_deserialize_default, annotation) - - -def _deserialize_with_callable( - deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], - value: typing.Any, -): # pylint: disable=too-many-return-statements - try: - if value is None or isinstance(value, _Null): - return None - if isinstance(value, ET.Element): - if deserializer is str: - return value.text or "" - if deserializer is int: - return int(value.text) if value.text else None - if deserializer is float: - return float(value.text) if value.text else None - if deserializer is bool: - return value.text == "true" if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): - return deserializer(value.text) if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): - return deserializer(value.text) if value.text else None - if deserializer is None: - return value - if deserializer in [int, float, bool]: - return deserializer(value) - if isinstance(deserializer, CaseInsensitiveEnumMeta): - try: - return deserializer(value.text if isinstance(value, ET.Element) else value) - except ValueError: - # for unknown value, return raw value - return value.text if isinstance(value, ET.Element) else value - if isinstance(deserializer, type) and issubclass(deserializer, Model): - return deserializer._deserialize(value, []) - return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) - except Exception as e: - raise DeserializationError() from e - - -def _deserialize( - deserializer: typing.Any, - value: typing.Any, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - if isinstance(value, PipelineResponse): - value = value.http_response.json() - if rf is None and format: - rf = _RestField(format=format) - if not isinstance(deserializer, functools.partial): - deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) - return _deserialize_with_callable(deserializer, value) - - -def _failsafe_deserialize( - deserializer: typing.Any, - response: HttpResponse, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - try: - return _deserialize(deserializer, response.json(), module, rf, format) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -def _failsafe_deserialize_xml( - deserializer: typing.Any, - response: HttpResponse, -) -> typing.Any: - try: - return _deserialize_xml(deserializer, response.text()) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -# pylint: disable=too-many-instance-attributes -class _RestField: - def __init__( - self, - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - is_discriminator: bool = False, - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, - ): - self._type = type - self._rest_name_input = name - self._module: typing.Optional[str] = None - self._is_discriminator = is_discriminator - self._visibility = visibility - self._is_model = False - self._is_optional = False - self._default = default - self._format = format - self._is_multipart_file_input = is_multipart_file_input - self._xml = xml if xml is not None else {} - self._deserializer = deserializer - - @property - def _class_type(self) -> typing.Any: - result = getattr(self._type, "args", [None])[0] - # type may be wrapped by nested functools.partial so we need to check for that - if isinstance(result, functools.partial): - return getattr(result, "args", [None])[0] - return result - - @property - def _rest_name(self) -> str: - if self._rest_name_input is None: - raise ValueError("Rest name was never set") - return self._rest_name_input - - def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin - # by this point, type and rest_name will have a value bc we default - # them in __new__ of the Model class - # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name, _UNSET) - if item is _UNSET: - # Field not set by user; return the client default if one exists, otherwise None - return self._default if self._default is not _UNSET else None - if item is None: - return item - if self._is_model: - return item - - # For mutable types, we want mutations to directly affect _data - # Check if we've already deserialized this value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - # Return the value from _data directly (it's been deserialized in place) - return obj._data.get(self._rest_name) - - # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) - if self._deserializer: - deserialized = self._deserializer(item) - else: - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) - - # For mutable types, store the deserialized value back in _data - # so mutations directly affect _data - if isinstance(deserialized, (dict, list, set)): - obj._data[self._rest_name] = deserialized - object.__setattr__(obj, cache_attr, True) # Mark as deserialized - return deserialized - - return deserialized - - def __set__(self, obj: Model, value) -> None: - # Clear the cached deserialized object when setting a new value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - object.__delattr__(obj, cache_attr) - - if value is None: - # we want to wipe out entries if users set attr to None - try: - obj.__delitem__(self._rest_name) - except KeyError: - pass - return - if self._is_model: - if not _is_model(value): - value = _deserialize(self._type, value) - obj.__setitem__(self._rest_name, value) - return - obj.__setitem__(self._rest_name, _serialize(value, self._format)) - - def _get_deserialize_callable_from_annotation( - self, annotation: typing.Any - ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - return _get_deserialize_callable_from_annotation(annotation, self._module, self) - - -def rest_field( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, -) -> typing.Any: - return _RestField( - name=name, - type=type, - visibility=visibility, - default=default, - format=format, - is_multipart_file_input=is_multipart_file_input, - xml=xml, - deserializer=deserializer, - ) - - -def rest_discriminator( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) - - -def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: - """Serialize a model to XML. - - :param Model model: The model to serialize. - :param bool exclude_readonly: Whether to exclude readonly properties. - :returns: The XML representation of the model. - :rtype: str - """ - return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore - - -def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: - """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. - - :param dict meta: The metadata dictionary to extract namespace from. - :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. - :rtype: str or None - """ - ns = meta.get("ns") - if ns is None: - ns = meta.get("namespace") - return ns - - -def _resolve_xml_ns( - prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None -) -> typing.Optional[str]: - """Resolve XML namespace for a property, falling back to model namespace when appropriate. - - Checks the property metadata first; if no namespace is found and the model does not declare - an explicit prefix, falls back to the model-level namespace. - - :param dict prop_meta: The property metadata dictionary. - :param dict model_meta: The model metadata dictionary, used as fallback. - :returns: The resolved namespace string, or None. - :rtype: str or None - """ - ns = _get_xml_ns(prop_meta) - if ns is None and model_meta is not None and not model_meta.get("prefix"): - ns = _get_xml_ns(model_meta) - return ns - - -def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: - """Set an XML attribute on an element, handling namespace prefix registration. - - :param ET.Element element: The element to set the attribute on. - :param str name: The default attribute name (wire name). - :param any value: The attribute value. - :param dict prop_meta: The property metadata dictionary. - """ - xml_name = prop_meta.get("name", name) - _attr_ns = _get_xml_ns(prop_meta) - if _attr_ns: - _attr_prefix = prop_meta.get("prefix") - if _attr_prefix: - _safe_register_namespace(_attr_prefix, _attr_ns) - xml_name = "{" + _attr_ns + "}" + xml_name - element.set(xml_name, _get_primitive_type_value(value)) - - -def _get_element( - o: typing.Any, - exclude_readonly: bool = False, - parent_meta: typing.Optional[dict[str, typing.Any]] = None, - wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, list[ET.Element]]: - if _is_model(o): - model_meta = getattr(o, "_xml", {}) - - # if prop is a model, then use the prop element directly, else generate a wrapper of model - if wrapped_element is None: - # When serializing as an array item (parent_meta is set), check if the parent has an - # explicit itemsName. This ensures correct element names for unwrapped arrays (where - # the element tag is the property/items name, not the model type name). - _items_name = parent_meta.get("itemsName") if parent_meta is not None else None - element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) - _model_ns = _get_xml_ns(model_meta) - wrapped_element = _create_xml_element( - element_name, - model_meta.get("prefix"), - _model_ns, - ) - - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - - for k, v in o.items(): - # do not serialize readonly properties - if exclude_readonly and k in readonly_props: - continue - - prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) - if prop_rest_field: - prop_meta = getattr(prop_rest_field, "_xml").copy() - # use the wire name as xml name if no specific name is set - if prop_meta.get("name") is None: - prop_meta["name"] = k - else: - # additional properties will not have rest field, use the wire name as xml name - prop_meta = {"name": k} - - # Propagate model namespace to properties only for old-style "ns"-keyed models. - # DPG-generated models use the "namespace" key and explicitly declare namespace on - # each property that needs it, so propagation is intentionally skipped for them. - if prop_meta.get("ns") is None and model_meta.get("ns"): - prop_meta["ns"] = model_meta.get("ns") - prop_meta["prefix"] = model_meta.get("prefix") - - if prop_meta.get("unwrapped", False): - # unwrapped could only set on array - wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) - elif prop_meta.get("text", False): - # text could only set on primitive type - wrapped_element.text = _get_primitive_type_value(v) - elif prop_meta.get("attribute", False): - _set_xml_attribute(wrapped_element, k, v, prop_meta) - else: - # other wrapped prop element - wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) - return wrapped_element - if isinstance(o, list): - return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore - if isinstance(o, dict): - result = [] - _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None - for k, v in o.items(): - result.append( - _get_wrapped_element( - v, - exclude_readonly, - { - "name": k, - "ns": _dict_ns, - "prefix": parent_meta.get("prefix") if parent_meta else None, - }, - ) - ) - return result - - # primitive case need to create element based on parent_meta - if parent_meta: - _items_ns = parent_meta.get("itemsNs") - if _items_ns is None: - _items_ns = _get_xml_ns(parent_meta) - return _get_wrapped_element( - o, - exclude_readonly, - { - "name": parent_meta.get("itemsName", parent_meta.get("name")), - "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": _items_ns, - }, - ) - - raise ValueError("Could not serialize value into xml: " + o) - - -def _get_wrapped_element( - v: typing.Any, - exclude_readonly: bool, - meta: typing.Optional[dict[str, typing.Any]], -) -> ET.Element: - _meta_ns = _get_xml_ns(meta) if meta else None - wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns - ) - if isinstance(v, (dict, list)): - wrapped_element.extend(_get_element(v, exclude_readonly, meta)) - elif _is_model(v): - _get_element(v, exclude_readonly, meta, wrapped_element) - else: - wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element # type: ignore[no-any-return] - - -def _get_primitive_type_value(v) -> str: - if v is True: - return "true" - if v is False: - return "false" - if isinstance(v, _Null): - return "" - return str(v) - - -def _safe_register_namespace(prefix: str, ns: str) -> None: - """Register an XML namespace prefix, handling reserved prefix patterns. - - Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for - auto-generated prefixes, causing register_namespace to raise ValueError. - Falls back to directly registering in the internal namespace map. - - :param str prefix: The namespace prefix to register. - :param str ns: The namespace URI. - """ - try: - ET.register_namespace(prefix, ns) - except ValueError: - _ns_map = getattr(ET, "_namespace_map", None) - if _ns_map is not None: - _ns_map[ns] = prefix - - -def _create_xml_element( - tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None -) -> ET.Element: - if prefix and ns: - _safe_register_namespace(prefix, ns) - if ns: - return ET.Element("{" + ns + "}" + tag) - return ET.Element(tag) - - -def _deserialize_xml( - deserializer: typing.Any, - value: str, -) -> typing.Any: - element = ET.fromstring(value) # nosec - if _is_model(deserializer): - return deserializer._deserialize(element, []) - return _deserialize(deserializer, element) - - -def _convert_element(e: ET.Element): - # dict case - if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: dict[str, typing.Any] = {} - for child in e: - if dict_result.get(child.tag) is not None: - if isinstance(dict_result[child.tag], list): - dict_result[child.tag].append(_convert_element(child)) - else: - dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] - else: - dict_result[child.tag] = _convert_element(child) - dict_result.update(e.attrib) - return dict_result - # array case - if len(e) > 0: - array_result: list[typing.Any] = [] - for child in e: - array_result.append(_convert_element(child)) - return array_result - # primitive case - return e.text diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/serialization.py deleted file mode 100644 index a088671e9c51..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/serialization.py +++ /dev/null @@ -1,2066 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # Fast path for header deserialization: response_data is a plain str or None - # and target_obj is a simple scalar type. This avoids the expensive - # _unpack_content → _deserialize → _classify_target → deserialize_data chain. - if response_data is None: - return None - if target_obj == "str" and isinstance(response_data, str): - return response_data - if isinstance(response_data, str): - if target_obj == "int": - return int(response_data) - if target_obj == "bool": - if response_data in ("true", "1", "True"): - return True - if response_data in ("false", "0", "False"): - return False - return bool(response_data) - if target_obj == "rfc-1123": - return Deserializer.deserialize_rfc(response_data) - if target_obj == "bytearray": - return Deserializer.deserialize_bytearray(response_data) - - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/utils.py deleted file mode 100644 index 35c9c836f85f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_utils/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_version.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_version.py deleted file mode 100644 index be71c81bd282..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b1" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/__init__.py deleted file mode 100644 index db076018c2a5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import NamingClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "NamingClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/_client.py deleted file mode 100644 index 22e8f2184a78..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/_client.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -import sys -from typing import Any, Awaitable - -from azure.core import AsyncPipelineClient -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .._utils.serialization import Deserializer, Serializer -from ._configuration import NamingClientConfiguration -from .operations import ( - HeaderOperations, - ModelClientOperations, - PropertyOperations, - UnionEnumOperations, - _NamingClientOperationsMixin, -) - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class NamingClient(_NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Describe changing names of types in a client with ``@clientName``. - - :ivar property: PropertyOperations operations - :vartype property: client.naming.typeddict.aio.operations.PropertyOperations - :ivar header: HeaderOperations operations - :vartype header: client.naming.typeddict.aio.operations.HeaderOperations - :ivar model_client: ModelClientOperations operations - :vartype model_client: client.naming.typeddict.aio.operations.ModelClientOperations - :ivar union_enum: UnionEnumOperations operations - :vartype union_enum: client.naming.typeddict.aio.operations.UnionEnumOperations - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = NamingClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - self.property = PropertyOperations(self._client, self._config, self._serialize, self._deserialize) - self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) - self.model_client = ModelClientOperations(self._client, self._config, self._serialize, self._deserialize) - self.union_enum = UnionEnumOperations(self._client, self._config, self._serialize, self._deserialize) - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/_configuration.py deleted file mode 100644 index 60bc3a9f6084..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from .._version import VERSION - - -class NamingClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for NamingClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "client-naming-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/operations/__init__.py deleted file mode 100644 index 8f7ae867ebad..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/operations/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import PropertyOperations # type: ignore -from ._operations import HeaderOperations # type: ignore -from ._operations import ModelClientOperations # type: ignore -from ._operations import UnionEnumOperations # type: ignore -from ._operations import _NamingClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "PropertyOperations", - "HeaderOperations", - "ModelClientOperations", - "UnionEnumOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/operations/_operations.py deleted file mode 100644 index 2bf3d872e4bb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/operations/_operations.py +++ /dev/null @@ -1,931 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import models as _models, types -from ..._utils.model_base import SdkJSONEncoder -from ..._utils.serialization import Deserializer, Serializer -from ..._utils.utils import ClientMixinABC -from ...operations._operations import ( - build_header_request_request, - build_header_response_request, - build_model_client_client_request, - build_model_client_language_request, - build_naming_client_name_request, - build_naming_parameter_request, - build_property_client_request, - build_property_compatible_with_encoded_name_request, - build_property_language_request, - build_union_enum_union_enum_member_name_request, - build_union_enum_union_enum_name_request, -) -from .._configuration import NamingClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~client.naming.typeddict.aio.NamingClient`'s - :attr:`property` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NamingClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def client( - self, body: _models.ClientNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~client.naming.typeddict.models.ClientNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def client( - self, body: types.ClientNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~client.naming.typeddict.types.ClientNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def client(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def client( - self, body: Union[_models.ClientNameModel, types.ClientNameModel, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is either a ClientNameModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.ClientNameModel or - ~client.naming.typeddict.types.ClientNameModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def language( - self, body: _models.LanguageClientNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~client.naming.typeddict.models.LanguageClientNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def language( - self, body: types.LanguageClientNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~client.naming.typeddict.types.LanguageClientNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def language(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def language( - self, body: Union[_models.LanguageClientNameModel, types.LanguageClientNameModel, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is either a LanguageClientNameModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.LanguageClientNameModel or - ~client.naming.typeddict.types.LanguageClientNameModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def compatible_with_encoded_name( - self, body: _models.ClientNameAndJsonEncodedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """compatible_with_encoded_name. - - :param body: Required. - :type body: ~client.naming.typeddict.models.ClientNameAndJsonEncodedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def compatible_with_encoded_name( - self, body: types.ClientNameAndJsonEncodedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """compatible_with_encoded_name. - - :param body: Required. - :type body: ~client.naming.typeddict.types.ClientNameAndJsonEncodedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def compatible_with_encoded_name( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """compatible_with_encoded_name. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def compatible_with_encoded_name( - self, - body: Union[_models.ClientNameAndJsonEncodedNameModel, types.ClientNameAndJsonEncodedNameModel, IO[bytes]], - **kwargs: Any - ) -> None: - """compatible_with_encoded_name. - - :param body: Is either a ClientNameAndJsonEncodedNameModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.ClientNameAndJsonEncodedNameModel or - ~client.naming.typeddict.types.ClientNameAndJsonEncodedNameModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_compatible_with_encoded_name_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class HeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~client.naming.typeddict.aio.NamingClient`'s - :attr:`header` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NamingClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def request(self, *, client_name: str, **kwargs: Any) -> None: - """request. - - :keyword client_name: Required. - :paramtype client_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_request_request( - client_name=client_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def response(self, **kwargs: Any) -> None: - """response. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_response_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["default-name"] = self._deserialize("str", response.headers.get("default-name")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - -class ModelClientOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~client.naming.typeddict.aio.NamingClient`'s - :attr:`model_client` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NamingClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def client(self, body: _models.ClientModel, *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: ~client.naming.typeddict.models.ClientModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def client(self, body: types.ClientModel, *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: ~client.naming.typeddict.types.ClientModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def client(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def client(self, body: Union[_models.ClientModel, types.ClientModel, IO[bytes]], **kwargs: Any) -> None: - """client. - - :param body: Is either a ClientModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.ClientModel or - ~client.naming.typeddict.types.ClientModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_client_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def language( - self, body: _models.PythonModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~client.naming.typeddict.models.PythonModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def language(self, body: types.PythonModel, *, content_type: str = "application/json", **kwargs: Any) -> None: - """language. - - :param body: Required. - :type body: ~client.naming.typeddict.types.PythonModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def language(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def language(self, body: Union[_models.PythonModel, types.PythonModel, IO[bytes]], **kwargs: Any) -> None: - """language. - - :param body: Is either a PythonModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.PythonModel or - ~client.naming.typeddict.types.PythonModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_client_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class UnionEnumOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~client.naming.typeddict.aio.NamingClient`'s - :attr:`union_enum` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NamingClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def union_enum_name(self, body: Union[str, _models.ClientExtensibleEnum], **kwargs: Any) -> None: - """union_enum_name. - - :param body: "value1" Required. - :type body: str or ~client.naming.typeddict.models.ClientExtensibleEnum - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_union_enum_union_enum_name_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def union_enum_member_name(self, body: Union[str, _models.ExtensibleEnum], **kwargs: Any) -> None: - """union_enum_member_name. - - :param body: Known values are: "value1" and "value2". Required. - :type body: str or ~client.naming.typeddict.models.ExtensibleEnum - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_union_enum_union_enum_member_name_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _NamingClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], NamingClientConfiguration] -): - - @distributed_trace_async - async def client_name(self, **kwargs: Any) -> None: - """client_name. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_naming_client_name_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def parameter(self, *, client_name: str, **kwargs: Any) -> None: - """parameter. - - :keyword client_name: Required. - :paramtype client_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_naming_parameter_request( - client_name=client_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/aio/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/__init__.py deleted file mode 100644 index 4c81085e1cad..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models import ( # type: ignore - ClientModel, - ClientNameAndJsonEncodedNameModel, - ClientNameModel, - LanguageClientNameModel, - PythonModel, -) - -from ._enums import ( # type: ignore - ClientExtensibleEnum, - ExtensibleEnum, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ClientModel", - "ClientNameAndJsonEncodedNameModel", - "ClientNameModel", - "LanguageClientNameModel", - "PythonModel", - "ClientExtensibleEnum", - "ExtensibleEnum", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/_enums.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/_enums.py deleted file mode 100644 index c044283ff225..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/_enums.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ClientExtensibleEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of ClientExtensibleEnum.""" - - ENUM_VALUE1 = "value1" - """ENUM_VALUE1.""" - - -class ExtensibleEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of ExtensibleEnum.""" - - CLIENT_ENUM_VALUE1 = "value1" - """CLIENT_ENUM_VALUE1.""" - CLIENT_ENUM_VALUE2 = "value2" - """CLIENT_ENUM_VALUE2.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/_models.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/_models.py deleted file mode 100644 index 21efec012765..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/_models.py +++ /dev/null @@ -1,152 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 - -from typing import Any, Mapping, overload - -from .._utils.model_base import Model as _Model, rest_field - - -class ClientModel(_Model): - """ClientModel. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - default_name: bool = rest_field(name="defaultName", visibility=["read", "create", "update", "delete", "query"]) - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - default_name: bool, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class ClientNameAndJsonEncodedNameModel(_Model): - """ClientNameAndJsonEncodedNameModel. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - client_name: bool = rest_field(name="wireName", visibility=["read", "create", "update", "delete", "query"]) - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - client_name: bool, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class ClientNameModel(_Model): - """ClientNameModel. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - client_name: bool = rest_field(name="defaultName", visibility=["read", "create", "update", "delete", "query"]) - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - client_name: bool, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class LanguageClientNameModel(_Model): - """LanguageClientNameModel. - - :ivar python_name: Pass in true. Required. - :vartype python_name: bool - """ - - python_name: bool = rest_field(name="defaultName", visibility=["read", "create", "update", "delete", "query"]) - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - python_name: bool, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class PythonModel(_Model): - """PythonModel. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - default_name: bool = rest_field(name="defaultName", visibility=["read", "create", "update", "delete", "query"]) - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - default_name: bool, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/models/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/operations/__init__.py deleted file mode 100644 index 8f7ae867ebad..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/operations/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import PropertyOperations # type: ignore -from ._operations import HeaderOperations # type: ignore -from ._operations import ModelClientOperations # type: ignore -from ._operations import UnionEnumOperations # type: ignore -from ._operations import _NamingClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "PropertyOperations", - "HeaderOperations", - "ModelClientOperations", - "UnionEnumOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/operations/_operations.py deleted file mode 100644 index 473534d1a442..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/operations/_operations.py +++ /dev/null @@ -1,1057 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models, types -from .._configuration import NamingClientConfiguration -from .._utils.model_base import SdkJSONEncoder -from .._utils.serialization import Deserializer, Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_property_client_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/client/naming/property/client" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_property_language_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/client/naming/property/language" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_property_compatible_with_encoded_name_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/client/naming/property/compatible-with-encoded-name" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_header_request_request(*, client_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/client/naming/header" - - # Construct headers - _headers["default-name"] = _SERIALIZER.header("client_name", client_name, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_header_response_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/client/naming/header" - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_model_client_client_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/client/naming/model/client" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_model_client_language_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/client/naming/model/language" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_union_enum_union_enum_name_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: str = kwargs.pop("content_type") - # Construct URL - _url = "/client/naming/union-enum/union-enum-name" - - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_union_enum_union_enum_member_name_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: str = kwargs.pop("content_type") - # Construct URL - _url = "/client/naming/union-enum/union-enum-member-name" - - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_naming_client_name_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/client/naming/operation" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_naming_parameter_request(*, client_name: str, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/client/naming/parameter" - - # Construct parameters - _params["defaultName"] = _SERIALIZER.query("client_name", client_name, "str") - - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~client.naming.typeddict.NamingClient`'s - :attr:`property` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NamingClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def client(self, body: _models.ClientNameModel, *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: ~client.naming.typeddict.models.ClientNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def client(self, body: types.ClientNameModel, *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: ~client.naming.typeddict.types.ClientNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def client(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientNameModel, types.ClientNameModel, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is either a ClientNameModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.ClientNameModel or - ~client.naming.typeddict.types.ClientNameModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def language( - self, body: _models.LanguageClientNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~client.naming.typeddict.models.LanguageClientNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def language( - self, body: types.LanguageClientNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~client.naming.typeddict.types.LanguageClientNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def language(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.LanguageClientNameModel, types.LanguageClientNameModel, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is either a LanguageClientNameModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.LanguageClientNameModel or - ~client.naming.typeddict.types.LanguageClientNameModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def compatible_with_encoded_name( - self, body: _models.ClientNameAndJsonEncodedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """compatible_with_encoded_name. - - :param body: Required. - :type body: ~client.naming.typeddict.models.ClientNameAndJsonEncodedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def compatible_with_encoded_name( - self, body: types.ClientNameAndJsonEncodedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """compatible_with_encoded_name. - - :param body: Required. - :type body: ~client.naming.typeddict.types.ClientNameAndJsonEncodedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def compatible_with_encoded_name( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """compatible_with_encoded_name. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def compatible_with_encoded_name( # pylint: disable=inconsistent-return-statements - self, - body: Union[_models.ClientNameAndJsonEncodedNameModel, types.ClientNameAndJsonEncodedNameModel, IO[bytes]], - **kwargs: Any - ) -> None: - """compatible_with_encoded_name. - - :param body: Is either a ClientNameAndJsonEncodedNameModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.ClientNameAndJsonEncodedNameModel or - ~client.naming.typeddict.types.ClientNameAndJsonEncodedNameModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_compatible_with_encoded_name_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class HeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~client.naming.typeddict.NamingClient`'s - :attr:`header` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NamingClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def request(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """request. - - :keyword client_name: Required. - :paramtype client_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_request_request( - client_name=client_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def response(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """response. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_response_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["default-name"] = self._deserialize("str", response.headers.get("default-name")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - -class ModelClientOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~client.naming.typeddict.NamingClient`'s - :attr:`model_client` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NamingClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def client(self, body: _models.ClientModel, *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: ~client.naming.typeddict.models.ClientModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def client(self, body: types.ClientModel, *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: ~client.naming.typeddict.types.ClientModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def client(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientModel, types.ClientModel, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is either a ClientModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.ClientModel or - ~client.naming.typeddict.types.ClientModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_client_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def language(self, body: _models.PythonModel, *, content_type: str = "application/json", **kwargs: Any) -> None: - """language. - - :param body: Required. - :type body: ~client.naming.typeddict.models.PythonModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def language(self, body: types.PythonModel, *, content_type: str = "application/json", **kwargs: Any) -> None: - """language. - - :param body: Required. - :type body: ~client.naming.typeddict.types.PythonModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def language(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.PythonModel, types.PythonModel, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is either a PythonModel type or a IO[bytes] type. Required. - :type body: ~client.naming.typeddict.models.PythonModel or - ~client.naming.typeddict.types.PythonModel or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_client_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class UnionEnumOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~client.naming.typeddict.NamingClient`'s - :attr:`union_enum` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: NamingClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def union_enum_name( # pylint: disable=inconsistent-return-statements - self, body: Union[str, _models.ClientExtensibleEnum], **kwargs: Any - ) -> None: - """union_enum_name. - - :param body: "value1" Required. - :type body: str or ~client.naming.typeddict.models.ClientExtensibleEnum - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_union_enum_union_enum_name_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def union_enum_member_name( # pylint: disable=inconsistent-return-statements - self, body: Union[str, _models.ExtensibleEnum], **kwargs: Any - ) -> None: - """union_enum_member_name. - - :param body: Known values are: "value1" and "value2". Required. - :type body: str or ~client.naming.typeddict.models.ExtensibleEnum - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_union_enum_union_enum_member_name_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _NamingClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], NamingClientConfiguration] -): - - @distributed_trace - def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """client_name. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_naming_client_name_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def parameter(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """parameter. - - :keyword client_name: Required. - :paramtype client_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_naming_parameter_request( - client_name=client_name, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/py.typed b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/types.py deleted file mode 100644 index c40ca5d84127..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/client/naming/typeddict/types.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class ClientModel(TypedDict, total=False): - """ClientModel. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - defaultName: Required[bool] - """Pass in true. Required.""" - - -class ClientNameAndJsonEncodedNameModel(TypedDict, total=False): - """ClientNameAndJsonEncodedNameModel. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - wireName: Required[bool] - """Pass in true. Required.""" - - -class ClientNameModel(TypedDict, total=False): - """ClientNameModel. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - defaultName: Required[bool] - """Pass in true. Required.""" - - -class LanguageClientNameModel(TypedDict, total=False): - """LanguageClientNameModel. - - :ivar python_name: Pass in true. Required. - :vartype python_name: bool - """ - - defaultName: Required[bool] - """Pass in true. Required.""" - - -class PythonModel(TypedDict, total=False): - """PythonModel. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - defaultName: Required[bool] - """Pass in true. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/dev_requirements.txt b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/dev_requirements.txt deleted file mode 100644 index 0e53b6a72db5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/dev_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --e ../../../eng/tools/azure-sdk-tools -../../core/azure-core -aiohttp \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/conftest.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/conftest.py deleted file mode 100644 index e1548f36b47d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/conftest.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import os -import pytest -from dotenv import load_dotenv -from devtools_testutils import ( - test_proxy, - add_general_regex_sanitizer, - add_body_key_sanitizer, - add_header_regex_sanitizer, -) - -load_dotenv() - - -# For security, please avoid record sensitive identity information in recordings -@pytest.fixture(scope="session", autouse=True) -def add_sanitizers(test_proxy): - naming_subscription_id = os.environ.get("NAMING_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - naming_tenant_id = os.environ.get("NAMING_TENANT_ID", "00000000-0000-0000-0000-000000000000") - naming_client_id = os.environ.get("NAMING_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - naming_client_secret = os.environ.get("NAMING_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=naming_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=naming_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=naming_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=naming_client_secret, value="00000000-0000-0000-0000-000000000000") - - add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") - add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming.py deleted file mode 100644 index aee03e7c8fa5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import NamingClientTestBase, NamingPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNaming(NamingClientTestBase): - @NamingPreparer() - @recorded_by_proxy - def test_client_name(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.client_name() - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy - def test_parameter(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.parameter( - client_name="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_async.py deleted file mode 100644 index c7981ab806c5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_async.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import NamingPreparer -from testpreparer_async import NamingClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNamingAsync(NamingClientTestBaseAsync): - @NamingPreparer() - @recorded_by_proxy_async - async def test_client_name(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.client_name() - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy_async - async def test_parameter(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.parameter( - client_name="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_header_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_header_operations.py deleted file mode 100644 index 903ab5b5f3f2..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_header_operations.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import NamingClientTestBase, NamingPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNamingHeaderOperations(NamingClientTestBase): - @NamingPreparer() - @recorded_by_proxy - def test_header_request(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.header.request( - client_name="str", - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy - def test_header_response(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.header.response() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_header_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_header_operations_async.py deleted file mode 100644 index 6b3a7df3800d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_header_operations_async.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import NamingPreparer -from testpreparer_async import NamingClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNamingHeaderOperationsAsync(NamingClientTestBaseAsync): - @NamingPreparer() - @recorded_by_proxy_async - async def test_header_request(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.header.request( - client_name="str", - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy_async - async def test_header_response(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.header.response() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_model_client_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_model_client_operations.py deleted file mode 100644 index d568b026d1c4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_model_client_operations.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import NamingClientTestBase, NamingPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNamingModelClientOperations(NamingClientTestBase): - @NamingPreparer() - @recorded_by_proxy - def test_model_client_client(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.model_client.client( - body={"defaultName": bool}, - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy - def test_model_client_language(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.model_client.language( - body={"defaultName": bool}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_model_client_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_model_client_operations_async.py deleted file mode 100644 index 22986078e5f9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_model_client_operations_async.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import NamingPreparer -from testpreparer_async import NamingClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNamingModelClientOperationsAsync(NamingClientTestBaseAsync): - @NamingPreparer() - @recorded_by_proxy_async - async def test_model_client_client(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.model_client.client( - body={"defaultName": bool}, - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy_async - async def test_model_client_language(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.model_client.language( - body={"defaultName": bool}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_property_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_property_operations.py deleted file mode 100644 index 7b1eec6e38b1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_property_operations.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import NamingClientTestBase, NamingPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNamingPropertyOperations(NamingClientTestBase): - @NamingPreparer() - @recorded_by_proxy - def test_property_client(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.property.client( - body={"defaultName": bool}, - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy - def test_property_language(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.property.language( - body={"defaultName": bool}, - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy - def test_property_compatible_with_encoded_name(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.property.compatible_with_encoded_name( - body={"wireName": bool}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_property_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_property_operations_async.py deleted file mode 100644 index 374f4e70f905..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_property_operations_async.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import NamingPreparer -from testpreparer_async import NamingClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNamingPropertyOperationsAsync(NamingClientTestBaseAsync): - @NamingPreparer() - @recorded_by_proxy_async - async def test_property_client(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.property.client( - body={"defaultName": bool}, - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy_async - async def test_property_language(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.property.language( - body={"defaultName": bool}, - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy_async - async def test_property_compatible_with_encoded_name(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.property.compatible_with_encoded_name( - body={"wireName": bool}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_union_enum_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_union_enum_operations.py deleted file mode 100644 index 45e18f9ddc89..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_union_enum_operations.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import NamingClientTestBase, NamingPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNamingUnionEnumOperations(NamingClientTestBase): - @NamingPreparer() - @recorded_by_proxy - def test_union_enum_union_enum_name(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.union_enum.union_enum_name( - body="str", - content_type="str", - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy - def test_union_enum_union_enum_member_name(self, naming_endpoint): - client = self.create_client(endpoint=naming_endpoint) - response = client.union_enum.union_enum_member_name( - body="str", - content_type="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_union_enum_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_union_enum_operations_async.py deleted file mode 100644 index 141e125b6016..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/test_naming_union_enum_operations_async.py +++ /dev/null @@ -1,38 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import NamingPreparer -from testpreparer_async import NamingClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNamingUnionEnumOperationsAsync(NamingClientTestBaseAsync): - @NamingPreparer() - @recorded_by_proxy_async - async def test_union_enum_union_enum_name(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.union_enum.union_enum_name( - body="str", - content_type="str", - ) - - # please add some check logic here by yourself - # ... - - @NamingPreparer() - @recorded_by_proxy_async - async def test_union_enum_union_enum_member_name(self, naming_endpoint): - client = self.create_async_client(endpoint=naming_endpoint) - response = await client.union_enum.union_enum_member_name( - body="str", - content_type="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/testpreparer.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/testpreparer.py deleted file mode 100644 index a281132e0aac..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/testpreparer.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from client.naming.typeddict import NamingClient -from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer -import functools - - -class NamingClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(NamingClient) - return self.create_client_from_credential( - NamingClient, - credential=credential, - endpoint=endpoint, - ) - - -NamingPreparer = functools.partial(PowerShellPreparer, "naming", naming_endpoint="https://fake_naming_endpoint.com") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/testpreparer_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/testpreparer_async.py deleted file mode 100644 index 3f03c10b748e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/generated_tests/testpreparer_async.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from client.naming.typeddict.aio import NamingClient -from devtools_testutils import AzureRecordedTestCase - - -class NamingClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(NamingClient, is_async=True) - return self.create_client_from_credential( - NamingClient, - credential=credential, - endpoint=endpoint, - ) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/pyproject.toml b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/pyproject.toml deleted file mode 100644 index 321e8522c255..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming-typeddict/pyproject.toml +++ /dev/null @@ -1,60 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -[build-system] -requires = ["setuptools>=77.0.3", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "client-naming-typeddict" -authors = [ - { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, -] -description = "Microsoft Corporation Azure Client Naming Typeddict Client Library for Python" -license = "MIT" -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", -] -requires-python = ">=3.10" -keywords = ["azure", "azure sdk"] - -dependencies = [ - "isodate>=0.6.1", - "azure-core>=1.37.0", - "typing-extensions>=4.6.0", -] -dynamic = [ -"version", "readme" -] - -[project.urls] -repository = "https://github.com/Azure/azure-sdk-for-python" - -[tool.setuptools.dynamic] -version = {attr = "client.naming.typeddict._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} - -[tool.setuptools.packages.find] -exclude = [ - "tests*", - "generated_tests*", - "samples*", - "generated_samples*", - "doc*", - "client", - "client.naming", -] - -[tool.setuptools.package-data] -pytyped = ["py.typed"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/types.py deleted file mode 100644 index c40ca5d84127..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-naming/client/naming/main/types.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class ClientModel(TypedDict, total=False): - """ClientModel. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - defaultName: Required[bool] - """Pass in true. Required.""" - - -class ClientNameAndJsonEncodedNameModel(TypedDict, total=False): - """ClientNameAndJsonEncodedNameModel. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - wireName: Required[bool] - """Pass in true. Required.""" - - -class ClientNameModel(TypedDict, total=False): - """ClientNameModel. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - defaultName: Required[bool] - """Pass in true. Required.""" - - -class LanguageClientNameModel(TypedDict, total=False): - """LanguageClientNameModel. - - :ivar python_name: Pass in true. Required. - :vartype python_name: bool - """ - - defaultName: Required[bool] - """Pass in true. Required.""" - - -class PythonModel(TypedDict, total=False): - """PythonModel. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - defaultName: Required[bool] - """Pass in true. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/types.py deleted file mode 100644 index 6eb530279947..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-overload/client/overload/types.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Resource(TypedDict, total=False): - """Resource. - - :ivar id: Required. - :vartype id: str - :ivar name: Required. - :vartype name: str - :ivar scope: Required. - :vartype scope: str - """ - - id: Required[str] - """Required.""" - name: Required[str] - """Required.""" - scope: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/__init__.py deleted file mode 100644 index d15db16e70ef..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _FirstClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _SecondClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_operations.py deleted file mode 100644 index 62c6ce3e23b7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_operations.py +++ /dev/null @@ -1,352 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace - -from .._configuration import FirstClientConfiguration, SecondClientConfiguration -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_first_one_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/one" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_first_two_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/two" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_first_three_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/three" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_first_four_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/four" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_second_five_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/five" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_second_six_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/six" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -class _FirstClientOperationsMixin(ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], FirstClientConfiguration]): - - @distributed_trace - def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """one. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_first_one_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """two. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_first_two_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """three. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_first_three_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """four. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_first_four_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _SecondClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], SecondClientConfiguration] -): - - @distributed_trace - def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """five. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_second_five_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """six. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_second_six_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py deleted file mode 100644 index ea765788358a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/__init__.py deleted file mode 100644 index d15db16e70ef..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _FirstClientOperationsMixin # type: ignore # pylint: disable=unused-import -from ._operations import _SecondClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_operations.py deleted file mode 100644 index d756685ca5db..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_operations.py +++ /dev/null @@ -1,317 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async - -from ..._operations._operations import ( - build_first_four_request, - build_first_one_request, - build_first_three_request, - build_first_two_request, - build_second_five_request, - build_second_six_request, -) -from ..._utils.utils import ClientMixinABC -from .._configuration import FirstClientConfiguration, SecondClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _FirstClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], FirstClientConfiguration] -): - - @distributed_trace_async - async def one(self, **kwargs: Any) -> None: - """one. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_first_one_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def two(self, **kwargs: Any) -> None: - """two. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_first_two_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def three(self, **kwargs: Any) -> None: - """three. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_first_three_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def four(self, **kwargs: Any) -> None: - """four. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_first_four_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class _SecondClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], SecondClientConfiguration] -): - - @distributed_trace_async - async def five(self, **kwargs: Any) -> None: - """five. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_second_five_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def six(self, **kwargs: Any) -> None: - """six. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_second_six_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py deleted file mode 100644 index ea765788358a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-default/client/structure/service/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/__init__.py deleted file mode 100644 index 80532a9c6f3d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _RenamedOperationClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_operations.py deleted file mode 100644 index 7cd9b30af589..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_operations.py +++ /dev/null @@ -1,349 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace - -from .._configuration import RenamedOperationClientConfiguration -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_renamed_operation_renamed_one_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - # Construct URL - _url = "/one" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_renamed_operation_renamed_three_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - # Construct URL - _url = "/three" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_renamed_operation_renamed_five_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - # Construct URL - _url = "/five" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_renamed_operation_renamed_two_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - # Construct URL - _url = "/two" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_renamed_operation_renamed_four_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - # Construct URL - _url = "/four" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_renamed_operation_renamed_six_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - # Construct URL - _url = "/six" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -class _RenamedOperationClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], RenamedOperationClientConfiguration] -): - - @distributed_trace - def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """renamed_one. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_one_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """renamed_three. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_three_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """renamed_five. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_five_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """renamed_two. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_two_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """renamed_four. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_four_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """renamed_six. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_six_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py deleted file mode 100644 index ea765788358a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/__init__.py deleted file mode 100644 index 80532a9c6f3d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _RenamedOperationClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_operations.py deleted file mode 100644 index 42128333db4f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_operations.py +++ /dev/null @@ -1,312 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async - -from ..._operations._operations import ( - build_renamed_operation_renamed_five_request, - build_renamed_operation_renamed_four_request, - build_renamed_operation_renamed_one_request, - build_renamed_operation_renamed_six_request, - build_renamed_operation_renamed_three_request, - build_renamed_operation_renamed_two_request, -) -from ..._utils.utils import ClientMixinABC -from .._configuration import RenamedOperationClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _RenamedOperationClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], RenamedOperationClientConfiguration] -): - - @distributed_trace_async - async def renamed_one(self, **kwargs: Any) -> None: - """renamed_one. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_one_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def renamed_three(self, **kwargs: Any) -> None: - """renamed_three. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_three_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def renamed_five(self, **kwargs: Any) -> None: - """renamed_five. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_five_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def renamed_two(self, **kwargs: Any) -> None: - """renamed_two. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_two_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def renamed_four(self, **kwargs: Any) -> None: - """renamed_four. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_four_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def renamed_six(self, **kwargs: Any) -> None: - """renamed_six. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_renamed_operation_renamed_six_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py deleted file mode 100644 index ea765788358a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/__init__.py deleted file mode 100644 index 46bd9b49069a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _TwoOperationGroupClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_operations.py deleted file mode 100644 index abb9a36f30ba..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_operations.py +++ /dev/null @@ -1,349 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace - -from .._configuration import TwoOperationGroupClientConfiguration -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_two_operation_group_one_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/one" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_two_operation_group_three_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/three" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_two_operation_group_four_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/four" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_two_operation_group_two_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/two" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_two_operation_group_five_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/five" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_two_operation_group_six_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/six" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -class _TwoOperationGroupClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], TwoOperationGroupClientConfiguration] -): - - @distributed_trace - def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """one. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_one_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """three. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_three_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """four. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_four_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """two. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_two_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """five. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_five_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """six. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_six_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py deleted file mode 100644 index ea765788358a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/utils.py deleted file mode 100644 index 35c9c836f85f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/__init__.py deleted file mode 100644 index 46bd9b49069a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _TwoOperationGroupClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_operations.py deleted file mode 100644 index 4715cf0ad39e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_operations.py +++ /dev/null @@ -1,312 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async - -from ..._operations._operations import ( - build_two_operation_group_five_request, - build_two_operation_group_four_request, - build_two_operation_group_one_request, - build_two_operation_group_six_request, - build_two_operation_group_three_request, - build_two_operation_group_two_request, -) -from ..._utils.utils import ClientMixinABC -from .._configuration import TwoOperationGroupClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _TwoOperationGroupClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], TwoOperationGroupClientConfiguration] -): - - @distributed_trace_async - async def one(self, **kwargs: Any) -> None: - """one. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_one_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def three(self, **kwargs: Any) -> None: - """three. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_three_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def four(self, **kwargs: Any) -> None: - """four. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_four_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def two(self, **kwargs: Any) -> None: - """two. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_two_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def five(self, **kwargs: Any) -> None: - """five. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_five_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def six(self, **kwargs: Any) -> None: - """six. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_two_operation_group_six_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str"), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py deleted file mode 100644 index ea765788358a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/generated_tests/test_two_operation_group.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/generated_tests/test_two_operation_group.py deleted file mode 100644 index af87d5cf3cc4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/generated_tests/test_two_operation_group.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import TwoOperationGroupClientTestBase, TwoOperationGroupPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestTwoOperationGroup(TwoOperationGroupClientTestBase): - @TwoOperationGroupPreparer() - @recorded_by_proxy - def test_one(self, twooperationgroup_endpoint): - client = self.create_client(endpoint=twooperationgroup_endpoint) - response = client.one() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy - def test_three(self, twooperationgroup_endpoint): - client = self.create_client(endpoint=twooperationgroup_endpoint) - response = client.three() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy - def test_four(self, twooperationgroup_endpoint): - client = self.create_client(endpoint=twooperationgroup_endpoint) - response = client.four() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy - def test_two(self, twooperationgroup_endpoint): - client = self.create_client(endpoint=twooperationgroup_endpoint) - response = client.two() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy - def test_five(self, twooperationgroup_endpoint): - client = self.create_client(endpoint=twooperationgroup_endpoint) - response = client.five() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy - def test_six(self, twooperationgroup_endpoint): - client = self.create_client(endpoint=twooperationgroup_endpoint) - response = client.six() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/generated_tests/test_two_operation_group_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/generated_tests/test_two_operation_group_async.py deleted file mode 100644 index a06484989511..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/client-structure-twooperationgroup/generated_tests/test_two_operation_group_async.py +++ /dev/null @@ -1,68 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import TwoOperationGroupPreparer -from testpreparer_async import TwoOperationGroupClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestTwoOperationGroupAsync(TwoOperationGroupClientTestBaseAsync): - @TwoOperationGroupPreparer() - @recorded_by_proxy_async - async def test_one(self, twooperationgroup_endpoint): - client = self.create_async_client(endpoint=twooperationgroup_endpoint) - response = await client.one() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy_async - async def test_three(self, twooperationgroup_endpoint): - client = self.create_async_client(endpoint=twooperationgroup_endpoint) - response = await client.three() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy_async - async def test_four(self, twooperationgroup_endpoint): - client = self.create_async_client(endpoint=twooperationgroup_endpoint) - response = await client.four() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy_async - async def test_two(self, twooperationgroup_endpoint): - client = self.create_async_client(endpoint=twooperationgroup_endpoint) - response = await client.two() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy_async - async def test_five(self, twooperationgroup_endpoint): - client = self.create_async_client(endpoint=twooperationgroup_endpoint) - response = await client.five() - - # please add some check logic here by yourself - # ... - - @TwoOperationGroupPreparer() - @recorded_by_proxy_async - async def test_six(self, twooperationgroup_endpoint): - client = self.create_async_client(endpoint=twooperationgroup_endpoint) - response = await client.six() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/property/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/property/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/property/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/property/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/types.py deleted file mode 100644 index f5a079fa935a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-array/encode/array/types.py +++ /dev/null @@ -1,145 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import Colors, ColorsExtensibleEnum - - -class CommaDelimitedArrayProperty(TypedDict, total=False): - """CommaDelimitedArrayProperty. - - :ivar value: Required. - :vartype value: list[str] - """ - - value: Required[list[str]] - """Required.""" - - -class CommaDelimitedEnumArrayProperty(TypedDict, total=False): - """CommaDelimitedEnumArrayProperty. - - :ivar value: Required. - :vartype value: list[str or ~encode.array.models.Colors] - """ - - value: Required[list[Union[str, "Colors"]]] - """Required.""" - - -class CommaDelimitedExtensibleEnumArrayProperty(TypedDict, total=False): # pylint: disable=name-too-long - """CommaDelimitedExtensibleEnumArrayProperty. - - :ivar value: Required. - :vartype value: list[str or ~encode.array.models.ColorsExtensibleEnum] - """ - - value: Required[list[Union[str, "ColorsExtensibleEnum"]]] - """Required.""" - - -class NewlineDelimitedArrayProperty(TypedDict, total=False): - """NewlineDelimitedArrayProperty. - - :ivar value: Required. - :vartype value: list[str] - """ - - value: Required[list[str]] - """Required.""" - - -class NewlineDelimitedEnumArrayProperty(TypedDict, total=False): - """NewlineDelimitedEnumArrayProperty. - - :ivar value: Required. - :vartype value: list[str or ~encode.array.models.Colors] - """ - - value: Required[list[Union[str, "Colors"]]] - """Required.""" - - -class NewlineDelimitedExtensibleEnumArrayProperty(TypedDict, total=False): # pylint: disable=name-too-long - """NewlineDelimitedExtensibleEnumArrayProperty. - - :ivar value: Required. - :vartype value: list[str or ~encode.array.models.ColorsExtensibleEnum] - """ - - value: Required[list[Union[str, "ColorsExtensibleEnum"]]] - """Required.""" - - -class PipeDelimitedArrayProperty(TypedDict, total=False): - """PipeDelimitedArrayProperty. - - :ivar value: Required. - :vartype value: list[str] - """ - - value: Required[list[str]] - """Required.""" - - -class PipeDelimitedEnumArrayProperty(TypedDict, total=False): - """PipeDelimitedEnumArrayProperty. - - :ivar value: Required. - :vartype value: list[str or ~encode.array.models.Colors] - """ - - value: Required[list[Union[str, "Colors"]]] - """Required.""" - - -class PipeDelimitedExtensibleEnumArrayProperty(TypedDict, total=False): - """PipeDelimitedExtensibleEnumArrayProperty. - - :ivar value: Required. - :vartype value: list[str or ~encode.array.models.ColorsExtensibleEnum] - """ - - value: Required[list[Union[str, "ColorsExtensibleEnum"]]] - """Required.""" - - -class SpaceDelimitedArrayProperty(TypedDict, total=False): - """SpaceDelimitedArrayProperty. - - :ivar value: Required. - :vartype value: list[str] - """ - - value: Required[list[str]] - """Required.""" - - -class SpaceDelimitedEnumArrayProperty(TypedDict, total=False): - """SpaceDelimitedEnumArrayProperty. - - :ivar value: Required. - :vartype value: list[str or ~encode.array.models.Colors] - """ - - value: Required[list[Union[str, "Colors"]]] - """Required.""" - - -class SpaceDelimitedExtensibleEnumArrayProperty(TypedDict, total=False): # pylint: disable=name-too-long - """SpaceDelimitedExtensibleEnumArrayProperty. - - :ivar value: Required. - :vartype value: list[str or ~encode.array.models.ColorsExtensibleEnum] - """ - - value: Required[list[Union[str, "ColorsExtensibleEnum"]]] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/types.py deleted file mode 100644 index 4b7c39a67465..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/types.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Base64BytesProperty(TypedDict, total=False): - """Base64BytesProperty. - - :ivar value: Required. - :vartype value: bytes - """ - - value: Required[bytes] - """Required.""" - - -class Base64urlArrayBytesProperty(TypedDict, total=False): - """Base64urlArrayBytesProperty. - - :ivar value: Required. - :vartype value: list[bytes] - """ - - value: Required[list[bytes]] - """Required.""" - - -class Base64urlBytesProperty(TypedDict, total=False): - """Base64urlBytesProperty. - - :ivar value: Required. - :vartype value: bytes - """ - - value: Required[bytes] - """Required.""" - - -class DefaultBytesProperty(TypedDict, total=False): - """DefaultBytesProperty. - - :ivar value: Required. - :vartype value: bytes - """ - - value: Required[bytes] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/types.py deleted file mode 100644 index 92a0f32c510f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-datetime/encode/datetime/types.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing_extensions import Required, TypedDict - - -class DefaultDatetimeProperty(TypedDict, total=False): - """DefaultDatetimeProperty. - - :ivar value: Required. - :vartype value: ~datetime.datetime - """ - - value: Required[datetime.datetime] - """Required.""" - - -class Rfc3339DatetimeProperty(TypedDict, total=False): - """Rfc3339DatetimeProperty. - - :ivar value: Required. - :vartype value: ~datetime.datetime - """ - - value: Required[datetime.datetime] - """Required.""" - - -class Rfc7231DatetimeProperty(TypedDict, total=False): - """Rfc7231DatetimeProperty. - - :ivar value: Required. - :vartype value: ~datetime.datetime - """ - - value: Required[datetime.datetime] - """Required.""" - - -class UnixTimestampArrayDatetimeProperty(TypedDict, total=False): - """UnixTimestampArrayDatetimeProperty. - - :ivar value: Required. - :vartype value: list[~datetime.datetime] - """ - - value: Required[list[datetime.datetime]] - """Required.""" - - -class UnixTimestampDatetimeProperty(TypedDict, total=False): - """UnixTimestampDatetimeProperty. - - :ivar value: Required. - :vartype value: ~datetime.datetime - """ - - value: Required[datetime.datetime] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/types.py deleted file mode 100644 index fb93fc55918e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-duration/encode/duration/types.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing_extensions import Required, TypedDict - - -class DefaultDurationProperty(TypedDict, total=False): - """DefaultDurationProperty. - - :ivar value: Required. - :vartype value: ~datetime.timedelta - """ - - value: Required[datetime.timedelta] - """Required.""" - - -class Float64MillisecondsDurationProperty(TypedDict, total=False): - """Float64MillisecondsDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class Float64SecondsDurationProperty(TypedDict, total=False): - """Float64SecondsDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class FloatMillisecondsDurationArrayProperty(TypedDict, total=False): - """FloatMillisecondsDurationArrayProperty. - - :ivar value: Required. - :vartype value: list[float] - """ - - value: Required[list[float]] - """Required.""" - - -class FloatMillisecondsDurationProperty(TypedDict, total=False): - """FloatMillisecondsDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class FloatMillisecondsLargerUnitDurationProperty(TypedDict, total=False): # pylint: disable=name-too-long - """FloatMillisecondsLargerUnitDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class FloatSecondsDurationArrayProperty(TypedDict, total=False): - """FloatSecondsDurationArrayProperty. - - :ivar value: Required. - :vartype value: list[float] - """ - - value: Required[list[float]] - """Required.""" - - -class FloatSecondsDurationProperty(TypedDict, total=False): - """FloatSecondsDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class FloatSecondsLargerUnitDurationProperty(TypedDict, total=False): - """FloatSecondsLargerUnitDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class Int32MillisecondsDurationProperty(TypedDict, total=False): - """Int32MillisecondsDurationProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class Int32MillisecondsLargerUnitDurationProperty(TypedDict, total=False): # pylint: disable=name-too-long - """Int32MillisecondsLargerUnitDurationProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class Int32SecondsDurationProperty(TypedDict, total=False): - """Int32SecondsDurationProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class Int32SecondsLargerUnitDurationProperty(TypedDict, total=False): - """Int32SecondsLargerUnitDurationProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class ISO8601DurationProperty(TypedDict, total=False): - """ISO8601DurationProperty. - - :ivar value: Required. - :vartype value: ~datetime.timedelta - """ - - value: Required[datetime.timedelta] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/types.py deleted file mode 100644 index 0440eedf606a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-numeric/encode/numeric/types.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class SafeintAsStringProperty(TypedDict, total=False): - """SafeintAsStringProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class Uint32AsStringProperty(TypedDict, total=False): - """Uint32AsStringProperty. - - :ivar value: - :vartype value: int - """ - - value: int - - -class Uint8AsStringProperty(TypedDict, total=False): - """Uint8AsStringProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/types.py deleted file mode 100644 index 067d1a22265f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleanfalse/headasbooleanfalse/types.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Optional -from typing_extensions import Required, TypedDict - - -class ReadOnlyModel(TypedDict, total=False): - """RoundTrip model with readonly optional properties. - - :ivar optional_nullable_int_list: Optional readonly nullable int list. - :vartype optional_nullable_int_list: list[int] - :ivar optional_string_record: Optional readonly string dictionary. - :vartype optional_string_record: dict[str, str] - """ - - optionalNullableIntList: Optional[list[int]] - """Optional readonly nullable int list.""" - optionalStringRecord: dict[str, str] - """Optional readonly string dictionary.""" - - -class VisibilityModel(TypedDict, total=False): - """Output model with visibility properties. - - :ivar read_prop: Required string, illustrating a readonly property. Required. - :vartype read_prop: str - :ivar create_prop: Required string[], illustrating a create property. Required. - :vartype create_prop: list[str] - :ivar update_prop: Required int32[], illustrating a update property. Required. - :vartype update_prop: list[int] - :ivar delete_prop: Required bool, illustrating a delete property. Required. - :vartype delete_prop: bool - """ - - readProp: Required[str] - """Required string, illustrating a readonly property. Required.""" - createProp: Required[list[str]] - """Required string[], illustrating a create property. Required.""" - updateProp: Required[list[int]] - """Required int32[], illustrating a update property. Required.""" - deleteProp: Required[bool] - """Required bool, illustrating a delete property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/types.py deleted file mode 100644 index 067d1a22265f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/headasbooleantrue/headasbooleantrue/types.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Optional -from typing_extensions import Required, TypedDict - - -class ReadOnlyModel(TypedDict, total=False): - """RoundTrip model with readonly optional properties. - - :ivar optional_nullable_int_list: Optional readonly nullable int list. - :vartype optional_nullable_int_list: list[int] - :ivar optional_string_record: Optional readonly string dictionary. - :vartype optional_string_record: dict[str, str] - """ - - optionalNullableIntList: Optional[list[int]] - """Optional readonly nullable int list.""" - optionalStringRecord: dict[str, str] - """Optional readonly string dictionary.""" - - -class VisibilityModel(TypedDict, total=False): - """Output model with visibility properties. - - :ivar read_prop: Required string, illustrating a readonly property. Required. - :vartype read_prop: str - :ivar create_prop: Required string[], illustrating a create property. Required. - :vartype create_prop: list[str] - :ivar update_prop: Required int32[], illustrating a update property. Required. - :vartype update_prop: list[int] - :ivar delete_prop: Required bool, illustrating a delete property. Required. - :vartype delete_prop: bool - """ - - readProp: Required[str] - """Required string, illustrating a readonly property. Required.""" - createProp: Required[list[str]] - """Required string[], illustrating a create property. Required.""" - updateProp: Required[list[int]] - """Required int32[], illustrating a update property. Required.""" - deleteProp: Required[bool] - """Required bool, illustrating a delete property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/types.py deleted file mode 100644 index 7c63b904b210..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-basic/parameters/basic/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class User(TypedDict, total=False): - """This is a simple model. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/types.py deleted file mode 100644 index 7f36a721ab1e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-body-optionality/parameters/bodyoptionality/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class BodyModel(TypedDict, total=False): - """BodyModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-path/parameters/path/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-query/parameters/query/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/types.py deleted file mode 100644 index c9d94550c49e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/parameters-spread/parameters/spread/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class BodyParameter(TypedDict, total=False): - """This is a simple model. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/types.py deleted file mode 100644 index b23dc7994949..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-content-negotiation/payload/contentnegotiation/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class PngImageAsJson(TypedDict, total=False): - """PngImageAsJson. - - :ivar content: Required. - :vartype content: bytes - """ - - content: Required[bytes] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-head/payload/head/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/types.py deleted file mode 100644 index e123287b24a7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/types.py +++ /dev/null @@ -1,82 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class InnerModel(TypedDict, total=False): - """It is the model used by Resource model. - - :ivar name: - :vartype name: str - :ivar description: - :vartype description: str - """ - - name: str - description: str - - -class Resource(TypedDict, total=False): - """Details about a resource. - - :ivar name: Required. - :vartype name: str - :ivar description: - :vartype description: str - :ivar map: - :vartype map: dict[str, ~payload.jsonmergepatch.models.InnerModel] - :ivar array: - :vartype array: list[~payload.jsonmergepatch.models.InnerModel] - :ivar int_value: - :vartype int_value: int - :ivar float_value: - :vartype float_value: float - :ivar inner_model: - :vartype inner_model: ~payload.jsonmergepatch.models.InnerModel - :ivar int_array: - :vartype int_array: list[int] - """ - - name: Required[str] - """Required.""" - description: str - map: dict[str, "InnerModel"] - array: list["InnerModel"] - intValue: int - floatValue: float - innerModel: "InnerModel" - intArray: list[int] - - -class ResourcePatch(TypedDict, total=False): - """Details about a resource for patch operation. - - :ivar description: - :vartype description: str - :ivar map: - :vartype map: dict[str, ~payload.jsonmergepatch.models.InnerModel] - :ivar array: - :vartype array: list[~payload.jsonmergepatch.models.InnerModel] - :ivar int_value: - :vartype int_value: int - :ivar float_value: - :vartype float_value: float - :ivar inner_model: - :vartype inner_model: ~payload.jsonmergepatch.models.InnerModel - :ivar int_array: - :vartype int_array: list[int] - """ - - description: str - map: dict[str, "InnerModel"] - array: list["InnerModel"] - intValue: int - floatValue: float - innerModel: "InnerModel" - intArray: list[int] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/types.py deleted file mode 100644 index 93a2de61a67a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-multipart/payload/multipart/types.py +++ /dev/null @@ -1,247 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - -from ._utils.utils import FileType - - -class Address(TypedDict, total=False): - """Address. - - :ivar city: Required. - :vartype city: str - """ - - city: Required[str] - """Required.""" - - -class AnonymousModelRequest(TypedDict, total=False): - """AnonymousModelRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" - - -class BinaryArrayPartsRequest(TypedDict, total=False): - """BinaryArrayPartsRequest. - - :ivar id: Required. - :vartype id: str - :ivar pictures: Required. - :vartype pictures: list[~payload.multipart._utils.utils.FileType] - """ - - id: Required[str] - """Required.""" - pictures: Required[list[FileType]] - """Required.""" - - -class ComplexHttpPartsModelRequest(TypedDict, total=False): - """ComplexHttpPartsModelRequest. - - :ivar id: Required. - :vartype id: str - :ivar address: Required. - :vartype address: ~payload.multipart.models.Address - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - :ivar previous_addresses: Required. - :vartype previous_addresses: list[~payload.multipart.models.Address] - :ivar pictures: Required. - :vartype pictures: list[~payload.multipart._utils.utils.FileType] - """ - - id: Required[str] - """Required.""" - address: Required["Address"] - """Required.""" - profileImage: Required[FileType] - """Required.""" - previousAddresses: Required[list["Address"]] - """Required.""" - pictures: Required[list[FileType]] - """Required.""" - - -class ComplexPartsRequest(TypedDict, total=False): - """ComplexPartsRequest. - - :ivar id: Required. - :vartype id: str - :ivar address: Required. - :vartype address: ~payload.multipart.models.Address - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - :ivar pictures: Required. - :vartype pictures: list[~payload.multipart._utils.utils.FileType] - """ - - id: Required[str] - """Required.""" - address: Required["Address"] - """Required.""" - profileImage: Required[FileType] - """Required.""" - pictures: Required[list[FileType]] - """Required.""" - - -class FileWithHttpPartOptionalContentTypeRequest(TypedDict, total=False): # pylint: disable=name-too-long - """FileWithHttpPartOptionalContentTypeRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" - - -class FileWithHttpPartRequiredContentTypeRequest(TypedDict, total=False): # pylint: disable=name-too-long - """FileWithHttpPartRequiredContentTypeRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" - - -class FileWithHttpPartSpecificContentTypeRequest(TypedDict, total=False): # pylint: disable=name-too-long - """FileWithHttpPartSpecificContentTypeRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" - - -class FloatRequest(TypedDict, total=False): - """FloatRequest. - - :ivar temperature: Required. - :vartype temperature: float - """ - - temperature: Required[float] - """Required.""" - - -class JsonPartRequest(TypedDict, total=False): - """JsonPartRequest. - - :ivar address: Required. - :vartype address: ~payload.multipart.models.Address - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - address: Required["Address"] - """Required.""" - profileImage: Required[FileType] - """Required.""" - - -class MultiBinaryPartsRequest(TypedDict, total=False): - """MultiBinaryPartsRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - :ivar picture: - :vartype picture: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" - picture: FileType - - -class MultiPartOptionalRequest(TypedDict, total=False): - """MultiPartOptionalRequest. - - :ivar id: - :vartype id: str - :ivar profile_image: - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - id: str - profileImage: FileType - - -class MultiPartRequest(TypedDict, total=False): - """MultiPartRequest. - - :ivar id: Required. - :vartype id: str - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - id: Required[str] - """Required.""" - profileImage: Required[FileType] - """Required.""" - - -class MultiPartRequestWithWireName(TypedDict, total=False): - """MultiPartRequestWithWireName. - - :ivar identifier: Required. - :vartype identifier: str - :ivar image: Required. - :vartype image: ~payload.multipart._utils.utils.FileType - """ - - id: Required[str] - """Required.""" - profileImage: Required[FileType] - """Required.""" - - -class UploadFileArrayRequest(TypedDict, total=False): - """UploadFileArrayRequest. - - :ivar files: Required. - :vartype files: list[~payload.multipart._utils.utils.FileType] - """ - - files: Required[list[FileType]] - """Required.""" - - -class UploadFileRequiredFilenameRequest(TypedDict, total=False): - """UploadFileRequiredFilenameRequest. - - :ivar file: Required. - :vartype file: ~payload.multipart._utils.utils.FileType - """ - - file: Required[FileType] - """Required.""" - - -class UploadFileSpecificContentTypeRequest(TypedDict, total=False): - """UploadFileSpecificContentTypeRequest. - - :ivar file: Required. - :vartype file: ~payload.multipart._utils.utils.FileType - """ - - file: Required[FileType] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py deleted file mode 100644 index ea765788358a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py deleted file mode 100644 index ea765788358a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/types.py deleted file mode 100644 index 971e105cce5f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Filter(TypedDict, total=False): - """Filter. - - :ivar filter: Required. - :vartype filter: str - """ - - filter: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/types.py deleted file mode 100644 index 0c9782b86d7b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/types.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from ...types import Pet - - -class RequestHeaderNestedResponseBodyResponseNestedItems(TypedDict, total=False): # pylint: disable=name-too-long - """RequestHeaderNestedResponseBodyResponseNestedItems. - - :ivar pets: Required. - :vartype pets: list[~payload.pageable.models.Pet] - """ - - pets: Required[list["Pet"]] - """Required.""" - - -class RequestHeaderNestedResponseBodyResponseNestedNext(TypedDict, total=False): # pylint: disable=name-too-long - """RequestHeaderNestedResponseBodyResponseNestedNext. - - :ivar next_token: - :vartype next_token: str - """ - - nextToken: str - - -class RequestQueryNestedResponseBodyResponseNestedItems(TypedDict, total=False): # pylint: disable=name-too-long - """RequestQueryNestedResponseBodyResponseNestedItems. - - :ivar pets: Required. - :vartype pets: list[~payload.pageable.models.Pet] - """ - - pets: Required[list["Pet"]] - """Required.""" - - -class RequestQueryNestedResponseBodyResponseNestedNext(TypedDict, total=False): # pylint: disable=name-too-long - """RequestQueryNestedResponseBodyResponseNestedNext. - - :ivar next_token: - :vartype next_token: str - """ - - nextToken: str diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/types.py deleted file mode 100644 index f478cd12cf0b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/types.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from ..types import Pet - - -class NestedLinkResponseNestedItems(TypedDict, total=False): - """NestedLinkResponseNestedItems. - - :ivar pets: Required. - :vartype pets: list[~payload.pageable.models.Pet] - """ - - pets: Required[list["Pet"]] - """Required.""" - - -class NestedLinkResponseNestedNext(TypedDict, total=False): - """NestedLinkResponseNestedNext. - - :ivar next: - :vartype next: str - """ - - next: str diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/types.py deleted file mode 100644 index 9cf62bff2c7b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/types.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Pet(TypedDict, total=False): - """Pet. - - :ivar id: Required. - :vartype id: str - :ivar name: Required. - :vartype name: str - """ - - id: Required[str] - """Required.""" - name: Required[str] - """Required.""" - - -class XmlPet(TypedDict, total=False): - """An XML pet item. - - :ivar id: Required. - :vartype id: str - :ivar name: Required. - :vartype name: str - """ - - id: Required[str] - """Required.""" - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/types.py deleted file mode 100644 index c871cb999e29..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/payload-xml/payload/xml/types.py +++ /dev/null @@ -1,394 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import Status - - -class Author(TypedDict, total=False): - """Author model with a custom XML name. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Book(TypedDict, total=False): - """Book model with a custom XML name. - - :ivar title: Required. - :vartype title: str - """ - - title: Required[str] - """Required.""" - - -class ModelWithArrayOfModel(TypedDict, total=False): - """§4.1 — Contains an array of models. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithAttributes(TypedDict, total=False): - """§5.1 — Contains fields that are XML attributes. - - :ivar id1: Required. - :vartype id1: int - :ivar id2: Required. - :vartype id2: str - :ivar enabled: Required. - :vartype enabled: bool - """ - - id1: Required[int] - """Required.""" - id2: Required[str] - """Required.""" - enabled: Required[bool] - """Required.""" - - -class ModelWithDatetime(TypedDict, total=False): - """Contains datetime properties with different encodings. - - :ivar rfc3339: DateTime value with rfc3339 encoding. Required. - :vartype rfc3339: ~datetime.datetime - :ivar rfc7231: DateTime value with rfc7231 encoding. Required. - :vartype rfc7231: ~datetime.datetime - """ - - rfc3339: Required[datetime.datetime] - """DateTime value with rfc3339 encoding. Required.""" - rfc7231: Required[datetime.datetime] - """DateTime value with rfc7231 encoding. Required.""" - - -class ModelWithDictionary(TypedDict, total=False): - """Contains a dictionary of key value pairs. - - :ivar metadata: Required. - :vartype metadata: dict[str, str] - """ - - metadata: Required[dict[str, str]] - """Required.""" - - -class ModelWithEmptyArray(TypedDict, total=False): - """Contains an array of models that's supposed to be sent/received as an empty XML element. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithEncodedNames(TypedDict, total=False): - """Uses encodedName instead of Xml.Name which is functionally equivalent. - - :ivar model_data: Required. - :vartype model_data: ~payload.xml.models.SimpleModel - :ivar colors: Required. - :vartype colors: list[str] - """ - - modelData: Required["SimpleModel"] - """Required.""" - colors: Required[list[str]] - """Required.""" - - -class ModelWithEnum(TypedDict, total=False): - """Contains a single property with an enum value. - - :ivar status: Required. Known values are: "pending", "success", and "error". - :vartype status: str or ~payload.xml.models.Status - """ - - status: Required[Union[str, "Status"]] - """Required. Known values are: \"pending\", \"success\", and \"error\".""" - - -class ModelWithNamespace(TypedDict, total=False): - """§6.1, §7.1 — Contains fields with XML namespace on the model. - - :ivar id: Required. - :vartype id: int - :ivar title: Required. - :vartype title: str - """ - - id: Required[int] - """Required.""" - title: Required[str] - """Required.""" - - -class ModelWithNamespaceOnProperties(TypedDict, total=False): - """§6.2, §7.2 — Contains fields with different XML namespaces on individual properties. - - :ivar id: Required. - :vartype id: int - :ivar title: Required. - :vartype title: str - :ivar author: Required. - :vartype author: str - """ - - id: Required[int] - """Required.""" - title: Required[str] - """Required.""" - author: Required[str] - """Required.""" - - -class ModelWithNestedModel(TypedDict, total=False): - """§2.1 — Contains a property that references another model. - - :ivar nested: Required. - :vartype nested: ~payload.xml.models.SimpleModel - """ - - nested: Required["SimpleModel"] - """Required.""" - - -class ModelWithOptionalField(TypedDict, total=False): - """Contains an optional field. - - :ivar item: Required. - :vartype item: str - :ivar value: - :vartype value: int - """ - - item: Required[str] - """Required.""" - value: int - - -class ModelWithRenamedArrays(TypedDict, total=False): - """§3.3, §3.4 — Contains fields of wrapped and unwrapped arrays of primitive types that have - different XML representations. - - :ivar colors: Required. - :vartype colors: list[str] - :ivar counts: Required. - :vartype counts: list[int] - """ - - colors: Required[list[str]] - """Required.""" - counts: Required[list[int]] - """Required.""" - - -class ModelWithRenamedAttribute(TypedDict, total=False): - """§5.2 — Contains a renamed XML attribute. - - :ivar id: Required. - :vartype id: int - :ivar title: Required. - :vartype title: str - :ivar author: Required. - :vartype author: str - """ - - id: Required[int] - """Required.""" - title: Required[str] - """Required.""" - author: Required[str] - """Required.""" - - -class ModelWithRenamedFields(TypedDict, total=False): - """§1.3, §2.3 — Contains fields of the same type that have different XML representation. - - :ivar input_data: Required. - :vartype input_data: ~payload.xml.models.SimpleModel - :ivar output_data: Required. - :vartype output_data: ~payload.xml.models.SimpleModel - """ - - inputData: Required["SimpleModel"] - """Required.""" - outputData: Required["SimpleModel"] - """Required.""" - - -class ModelWithRenamedNestedModel(TypedDict, total=False): - """§2.2 — Contains a property whose type has. - - :ivar author: Required. - :vartype author: ~payload.xml.models.Author - """ - - author: Required["Author"] - """Required.""" - - -class ModelWithRenamedProperty(TypedDict, total=False): - """§1.2 — Contains a scalar property with a custom XML name. - - :ivar title: Required. - :vartype title: str - :ivar author: Required. - :vartype author: str - """ - - title: Required[str] - """Required.""" - author: Required[str] - """Required.""" - - -class ModelWithRenamedUnwrappedModelArray(TypedDict, total=False): - """§4.4 — Contains an unwrapped array of models with a custom item name. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithRenamedWrappedAndItemModelArray(TypedDict, total=False): - """§4.5 — Contains a wrapped array of models with custom wrapper and item names. - - :ivar books: Required. - :vartype books: ~payload.xml.models.Book - """ - - books: Required[list["Book"]] - """Required.""" - - -class ModelWithRenamedWrappedModelArray(TypedDict, total=False): - """§4.3 — Contains a wrapped array of models with a custom wrapper name. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithSimpleArrays(TypedDict, total=False): - """§3.1 — Contains fields of arrays of primitive types. - - :ivar colors: Required. - :vartype colors: list[str] - :ivar counts: Required. - :vartype counts: list[int] - """ - - colors: Required[list[str]] - """Required.""" - counts: Required[list[int]] - """Required.""" - - -class ModelWithText(TypedDict, total=False): - """§8.1 — Contains an attribute and text. - - :ivar language: Required. - :vartype language: str - :ivar content: Required. - :vartype content: str - """ - - language: Required[str] - """Required.""" - content: Required[str] - """Required.""" - - -class ModelWithUnwrappedArray(TypedDict, total=False): - """§3.2 — Contains fields of wrapped and unwrapped arrays of primitive types. - - :ivar colors: Required. - :vartype colors: list[str] - :ivar counts: Required. - :vartype counts: list[int] - """ - - colors: Required[list[str]] - """Required.""" - counts: Required[list[int]] - """Required.""" - - -class ModelWithUnwrappedModelArray(TypedDict, total=False): - """§4.2 — Contains an unwrapped array of models. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithWrappedPrimitiveCustomItemNames(TypedDict, total=False): - """§3.5 — Contains a wrapped primitive array with custom wrapper and item names. - - :ivar tags: Required. - :vartype tags: list[str] - """ - - tags: Required[list[str]] - """Required.""" - - -class SimpleModel(TypedDict, total=False): - """§1.1 — Contains fields of primitive types. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - """ - - name: Required[str] - """Required.""" - age: Required[int] - """Required.""" - - -class XmlErrorBody(TypedDict, total=False): - """The body of an XML error response. - - :ivar message: Required. - :vartype message: str - :ivar code: Required. - :vartype code: int - """ - - message: Required[str] - """Required.""" - code: Required[int] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/types.py deleted file mode 100644 index 5b4d7ab8bde4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/response-status-code-range/response/statuscoderange/types.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class DefaultError(TypedDict, total=False): - """DefaultError. - - :ivar code: Required. - :vartype code: str - """ - - code: Required[str] - """Required.""" - - -class ErrorInRange(TypedDict, total=False): - """ErrorInRange. - - :ivar code: Required. - :vartype code: str - :ivar message: Required. - :vartype message: str - """ - - code: Required[str] - """Required.""" - message: Required[str] - """Required.""" - - -class NotFoundError(TypedDict, total=False): - """NotFoundError. - - :ivar code: Required. - :vartype code: str - :ivar resource_id: Required. - :vartype resource_id: str - """ - - code: Required[str] - """Required.""" - resourceId: Required[str] - """Required.""" - - -class Standard4XXError(TypedDict, total=False): - """Standard4XXError. - - :ivar code: Required. - :vartype code: str - """ - - code: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/types.py deleted file mode 100644 index cc3255f66a6c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class JsonEncodedNameModel(TypedDict, total=False): - """JsonEncodedNameModel. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - wireName: Required[bool] - """Pass in true. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-path-single/server/path/single/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multi-service/service/multiservice/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/CHANGELOG.md deleted file mode 100644 index b957b2575b48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release History - -## 1.0.0b1 (1970-01-01) - -### Other Changes - - - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/LICENSE b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/LICENSE deleted file mode 100644 index 63447fd8bbbf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/MANIFEST.in b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/MANIFEST.in deleted file mode 100644 index 7eaf672f009b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include *.md -include LICENSE -include service/multipleservices/servicea/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include service/__init__.py -include service/multipleservices/__init__.py diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/_metadata.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/_metadata.json deleted file mode 100644 index f1f002f07766..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/_metadata.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "apiVersions": { - "Service.MultipleServices.ServiceA": "av2", - "Service.MultipleServices.ServiceB": "bv2" - } -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/apiview-properties.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/apiview-properties.json deleted file mode 100644 index 513d35da7908..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/apiview-properties.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "CrossLanguagePackageId": "Service.MultipleServices.ServiceA", - "CrossLanguageDefinitionId": { - "service.multipleservices.servicea.models.VersionsA": "Service.MultipleServices.ServiceA.VersionsA", - "service.multipleservices.servicea.models.VersionsB": "Service.MultipleServices.ServiceB.VersionsB", - "service.multipleservices.servicea.operations.SubNamespaceOperations.sub_op_a": "Service.MultipleServices.ServiceA.SubNamespace.subOpA", - "service.multipleservices.servicea.aio.operations.SubNamespaceOperations.sub_op_a": "Service.MultipleServices.ServiceA.SubNamespace.subOpA", - "service.multipleservices.servicea.operations.Operations.op_a": "Service.MultipleServices.ServiceA.Operations.opA", - "service.multipleservices.servicea.aio.operations.Operations.op_a": "Service.MultipleServices.ServiceA.Operations.opA", - "service.multipleservices.servicea.operations.SubNamespaceOperations.sub_op_b": "Service.MultipleServices.ServiceB.SubNamespace.subOpB", - "service.multipleservices.servicea.aio.operations.SubNamespaceOperations.sub_op_b": "Service.MultipleServices.ServiceB.SubNamespace.subOpB", - "service.multipleservices.servicea.operations.Operations.op_b": "Service.MultipleServices.ServiceB.Operations.opB", - "service.multipleservices.servicea.aio.operations.Operations.op_b": "Service.MultipleServices.ServiceB.Operations.opB" - } -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/dev_requirements.txt b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/dev_requirements.txt deleted file mode 100644 index 0e53b6a72db5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/dev_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --e ../../../eng/tools/azure-sdk-tools -../../core/azure-core -aiohttp \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/conftest.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/conftest.py deleted file mode 100644 index 27def9cbbbfb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/conftest.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import os -import pytest -from dotenv import load_dotenv -from devtools_testutils import ( - test_proxy, - add_general_regex_sanitizer, - add_body_key_sanitizer, - add_header_regex_sanitizer, -) - -load_dotenv() - - -# For security, please avoid record sensitive identity information in recordings -@pytest.fixture(scope="session", autouse=True) -def add_sanitizers(test_proxy): - servicea_subscription_id = os.environ.get("SERVICEA_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - servicea_tenant_id = os.environ.get("SERVICEA_TENANT_ID", "00000000-0000-0000-0000-000000000000") - servicea_client_id = os.environ.get("SERVICEA_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - servicea_client_secret = os.environ.get("SERVICEA_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=servicea_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=servicea_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=servicea_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=servicea_client_secret, value="00000000-0000-0000-0000-000000000000") - - serviceb_subscription_id = os.environ.get("SERVICEB_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - serviceb_tenant_id = os.environ.get("SERVICEB_TENANT_ID", "00000000-0000-0000-0000-000000000000") - serviceb_client_id = os.environ.get("SERVICEB_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - serviceb_client_secret = os.environ.get("SERVICEB_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=serviceb_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=serviceb_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=serviceb_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=serviceb_client_secret, value="00000000-0000-0000-0000-000000000000") - - add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") - add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_aoperations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_aoperations.py deleted file mode 100644 index c8cb3ad4cdbd..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_aoperations.py +++ /dev/null @@ -1,22 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import ServiceAClientTestBase, ServiceAPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestServiceAOperations(ServiceAClientTestBase): - @ServiceAPreparer() - @recorded_by_proxy - def test_operations_op_a(self, servicea_endpoint): - client = self.create_client(endpoint=servicea_endpoint) - response = client.operations.op_a() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_aoperations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_aoperations_async.py deleted file mode 100644 index a5e8f6553572..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_aoperations_async.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import ServiceAPreparer -from testpreparer_async import ServiceAClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestServiceAOperationsAsync(ServiceAClientTestBaseAsync): - @ServiceAPreparer() - @recorded_by_proxy_async - async def test_operations_op_a(self, servicea_endpoint): - client = self.create_async_client(endpoint=servicea_endpoint) - response = await client.operations.op_a() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_asub_namespace_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_asub_namespace_operations.py deleted file mode 100644 index 505eb2937d6b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_asub_namespace_operations.py +++ /dev/null @@ -1,22 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import ServiceAClientTestBase, ServiceAPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestServiceASubNamespaceOperations(ServiceAClientTestBase): - @ServiceAPreparer() - @recorded_by_proxy - def test_sub_namespace_sub_op_a(self, servicea_endpoint): - client = self.create_client(endpoint=servicea_endpoint) - response = client.sub_namespace.sub_op_a() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_asub_namespace_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_asub_namespace_operations_async.py deleted file mode 100644 index 87b3c12a8c08..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_asub_namespace_operations_async.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import ServiceAPreparer -from testpreparer_async import ServiceAClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestServiceASubNamespaceOperationsAsync(ServiceAClientTestBaseAsync): - @ServiceAPreparer() - @recorded_by_proxy_async - async def test_sub_namespace_sub_op_a(self, servicea_endpoint): - client = self.create_async_client(endpoint=servicea_endpoint) - response = await client.sub_namespace.sub_op_a() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_boperations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_boperations.py deleted file mode 100644 index 8d14959b18eb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_boperations.py +++ /dev/null @@ -1,22 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import ServiceBClientTestBase, ServiceBPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestServiceBOperations(ServiceBClientTestBase): - @ServiceBPreparer() - @recorded_by_proxy - def test_operations_op_b(self, serviceb_endpoint): - client = self.create_client(endpoint=serviceb_endpoint) - response = client.operations.op_b() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_boperations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_boperations_async.py deleted file mode 100644 index 9cf17e6b7809..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_boperations_async.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import ServiceBPreparer -from testpreparer_async import ServiceBClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestServiceBOperationsAsync(ServiceBClientTestBaseAsync): - @ServiceBPreparer() - @recorded_by_proxy_async - async def test_operations_op_b(self, serviceb_endpoint): - client = self.create_async_client(endpoint=serviceb_endpoint) - response = await client.operations.op_b() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_bsub_namespace_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_bsub_namespace_operations.py deleted file mode 100644 index dac90a7a2d68..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_bsub_namespace_operations.py +++ /dev/null @@ -1,22 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import ServiceBClientTestBase, ServiceBPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestServiceBSubNamespaceOperations(ServiceBClientTestBase): - @ServiceBPreparer() - @recorded_by_proxy - def test_sub_namespace_sub_op_b(self, serviceb_endpoint): - client = self.create_client(endpoint=serviceb_endpoint) - response = client.sub_namespace.sub_op_b() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_bsub_namespace_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_bsub_namespace_operations_async.py deleted file mode 100644 index b35810f55941..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/test_service_bsub_namespace_operations_async.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import ServiceBPreparer -from testpreparer_async import ServiceBClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestServiceBSubNamespaceOperationsAsync(ServiceBClientTestBaseAsync): - @ServiceBPreparer() - @recorded_by_proxy_async - async def test_sub_namespace_sub_op_b(self, serviceb_endpoint): - client = self.create_async_client(endpoint=serviceb_endpoint) - response = await client.sub_namespace.sub_op_b() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/testpreparer.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/testpreparer.py deleted file mode 100644 index 5d6748e5331e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/testpreparer.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer -import functools -from service.multipleservices.servicea import ServiceAClient -from service.multipleservices.serviceb import ServiceBClient - - -class ServiceAClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(ServiceAClient) - return self.create_client_from_credential( - ServiceAClient, - credential=credential, - endpoint=endpoint, - ) - - -ServiceAPreparer = functools.partial( - PowerShellPreparer, "servicea", servicea_endpoint="https://fake_servicea_endpoint.com" -) - - -class ServiceBClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(ServiceBClient) - return self.create_client_from_credential( - ServiceBClient, - credential=credential, - endpoint=endpoint, - ) - - -ServiceBPreparer = functools.partial( - PowerShellPreparer, "serviceb", serviceb_endpoint="https://fake_serviceb_endpoint.com" -) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/testpreparer_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/testpreparer_async.py deleted file mode 100644 index 0f5897b7d8e4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/generated_tests/testpreparer_async.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase -from service.multipleservices.servicea.aio import ServiceAClient -from service.multipleservices.serviceb.aio import ServiceBClient - - -class ServiceAClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(ServiceAClient, is_async=True) - return self.create_client_from_credential( - ServiceAClient, - credential=credential, - endpoint=endpoint, - ) - - -class ServiceBClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(ServiceBClient, is_async=True) - return self.create_client_from_credential( - ServiceBClient, - credential=credential, - endpoint=endpoint, - ) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/pyproject.toml b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/pyproject.toml deleted file mode 100644 index 54c9d90c5929..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/pyproject.toml +++ /dev/null @@ -1,61 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -[build-system] -requires = ["setuptools>=77.0.3", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "service-multipleservices-servicea" -authors = [ - { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, -] -description = "Microsoft Corporation Azure Service Multipleservices Servicea Client Library for Python" -license = "MIT" -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", -] -requires-python = ">=3.9" -keywords = ["azure", "azure sdk"] - -dependencies = [ - "isodate>=0.6.1", - "azure-core>=1.37.0", - "typing-extensions>=4.6.0", -] -dynamic = [ -"version", "readme" -] - -[project.urls] -repository = "https://github.com/Azure/azure-sdk-for-python" - -[tool.setuptools.dynamic] -version = {attr = "service.multipleservices.servicea._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} - -[tool.setuptools.packages.find] -exclude = [ - "tests*", - "generated_tests*", - "samples*", - "generated_samples*", - "doc*", - "service", - "service.multipleservices", -] - -[tool.setuptools.package-data] -pytyped = ["py.typed"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/__init__.py deleted file mode 100644 index 8678a636153b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import ServiceAClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServiceAClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_client.py deleted file mode 100644 index 23a56f017bec..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_client.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any -from typing_extensions import Self - -from azure.core import PipelineClient -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse - -from ._configuration import ServiceAClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import Operations -from .subnamespace.operations import SubNamespaceOperations - - -class ServiceAClient: - """First service definition in a multiple-services package with versioning. Without explicit - ``@client``, this should create a separate root client (``ServiceAClient``). - - :ivar sub_namespace: SubNamespaceOperations operations - :vartype sub_namespace: service.multipleservices.servicea.operations.SubNamespaceOperations - :ivar operations: Operations operations - :vartype operations: service.multipleservices.servicea.operations.Operations - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - :keyword api_version: Known values are "av2". Default value is "av2". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str or ~service.multipleservices.servicea.models.VersionsA - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = ServiceAClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - self.sub_namespace = SubNamespaceOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_configuration.py deleted file mode 100644 index ba4388db9a14..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_configuration.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from ._version import VERSION - - -class ServiceAClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ServiceAClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - :keyword api_version: Known values are "av2". Default value is "av2". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str or ~service.multipleservices.servicea.models.VersionsA - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "av2") - - self.endpoint = endpoint - self.api_version = api_version - kwargs.setdefault("sdk_moniker", "service-multipleservices-servicea/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_utils/__init__.py deleted file mode 100644 index 8026245c2abc..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_utils/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_utils/model_base.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_utils/model_base.py deleted file mode 100644 index db24930fdca9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_utils/model_base.py +++ /dev/null @@ -1,1441 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=protected-access, broad-except - -import copy -import calendar -import decimal -import functools -import sys -import logging -import base64 -import re -import typing -import enum -import email.utils -from datetime import datetime, date, time, timedelta, timezone -from json import JSONEncoder -import xml.etree.ElementTree as ET -from collections.abc import MutableMapping -from typing_extensions import Self -import isodate -from azure.core.exceptions import DeserializationError -from azure.core import CaseInsensitiveEnumMeta -from azure.core.pipeline import PipelineResponse -from azure.core.serialization import _Null -from azure.core.rest import HttpResponse - -_LOGGER = logging.getLogger(__name__) - -__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] - -TZ_UTC = timezone.utc -_T = typing.TypeVar("_T") -_NONE_TYPE = type(None) - - -def _timedelta_as_isostr(td: timedelta) -> str: - """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' - - Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython - - :param timedelta td: The timedelta to convert - :rtype: str - :return: ISO8601 version of this timedelta - """ - - # Split seconds to larger units - seconds = td.total_seconds() - minutes, seconds = divmod(seconds, 60) - hours, minutes = divmod(minutes, 60) - days, hours = divmod(hours, 24) - - days, hours, minutes = list(map(int, (days, hours, minutes))) - seconds = round(seconds, 6) - - # Build date - date_str = "" - if days: - date_str = "%sD" % days - - if hours or minutes or seconds: - # Build time - time_str = "T" - - # Hours - bigger_exists = date_str or hours - if bigger_exists: - time_str += "{:02}H".format(hours) - - # Minutes - bigger_exists = bigger_exists or minutes - if bigger_exists: - time_str += "{:02}M".format(minutes) - - # Seconds - try: - if seconds.is_integer(): - seconds_string = "{:02}".format(int(seconds)) - else: - # 9 chars long w/ leading 0, 6 digits after decimal - seconds_string = "%09.6f" % seconds - # Remove trailing zeros - seconds_string = seconds_string.rstrip("0") - except AttributeError: # int.is_integer() raises - seconds_string = "{:02}".format(seconds) - - time_str += "{}S".format(seconds_string) - else: - time_str = "" - - return "P" + date_str + time_str - - -def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: - encoded = base64.b64encode(o).decode() - if format == "base64url": - return encoded.strip("=").replace("+", "-").replace("/", "_") - return encoded - - -def _serialize_datetime(o, format: typing.Optional[str] = None): - if hasattr(o, "year") and hasattr(o, "hour"): - if format == "rfc7231": - return email.utils.format_datetime(o, usegmt=True) - if format == "unix-timestamp": - return int(calendar.timegm(o.utctimetuple())) - - # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) - if not o.tzinfo: - iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() - else: - iso_formatted = o.astimezone(TZ_UTC).isoformat() - # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) - return iso_formatted.replace("+00:00", "Z") - # Next try datetime.date or datetime.time - return o.isoformat() - - -def _is_readonly(p): - try: - return p._visibility == ["read"] - except AttributeError: - return False - - -class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" - - def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): - super().__init__(*args, **kwargs) - self.exclude_readonly = exclude_readonly - self.format = format - - def default(self, o): # pylint: disable=too-many-return-statements - if _is_model(o): - if self.exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - return {k: v for k, v in o.items() if k not in readonly_props} - return dict(o.items()) - try: - return super(SdkJSONEncoder, self).default(o) - except TypeError: - if isinstance(o, _Null): - return None - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, self.format) - try: - # First try datetime.datetime - return _serialize_datetime(o, self.format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return super(SdkJSONEncoder, self).default(o) - - -_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") -_VALID_RFC7231 = re.compile( - r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" - r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" -) - -_ARRAY_ENCODE_MAPPING = { - "pipeDelimited": "|", - "spaceDelimited": " ", - "commaDelimited": ",", - "newlineDelimited": "\n", -} - - -def _deserialize_array_encoded(delimit: str, attr): - if isinstance(attr, str): - if attr == "": - return [] - return attr.split(delimit) - return attr - - -def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - attr = attr.upper() - match = _VALID_DATE.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - return date_obj # type: ignore[no-any-return] - - -def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize RFC7231 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - match = _VALID_RFC7231.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - return email.utils.parsedate_to_datetime(attr) - - -def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: - """Deserialize unix timestamp into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - return datetime.fromtimestamp(attr, TZ_UTC) - - -def _deserialize_date(attr: typing.Union[str, date]) -> date: - """Deserialize ISO-8601 formatted string into Date object. - :param str attr: response string to be deserialized. - :rtype: date - :returns: The date object from that input - """ - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - if isinstance(attr, date): - return attr - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore - - -def _deserialize_time(attr: typing.Union[str, time]) -> time: - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :returns: The time object from that input - """ - if isinstance(attr, time): - return attr - return isodate.parse_time(attr) # type: ignore[no-any-return] - - -def _deserialize_bytes(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - return bytes(base64.b64decode(attr)) - - -def _deserialize_bytes_base64(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return bytes(base64.b64decode(encoded)) - - -def _deserialize_duration(attr): - if isinstance(attr, timedelta): - return attr - return isodate.parse_duration(attr) - - -def _deserialize_decimal(attr): - if isinstance(attr, decimal.Decimal): - return attr - return decimal.Decimal(str(attr)) - - -def _deserialize_int_as_str(attr): - if isinstance(attr, int): - return attr - return int(attr) - - -_DESERIALIZE_MAPPING = { - datetime: _deserialize_datetime, - date: _deserialize_date, - time: _deserialize_time, - bytes: _deserialize_bytes, - bytearray: _deserialize_bytes, - timedelta: _deserialize_duration, - typing.Any: lambda x: x, - decimal.Decimal: _deserialize_decimal, -} - -_DESERIALIZE_MAPPING_WITHFORMAT = { - "rfc3339": _deserialize_datetime, - "rfc7231": _deserialize_datetime_rfc7231, - "unix-timestamp": _deserialize_datetime_unix_timestamp, - "base64": _deserialize_bytes, - "base64url": _deserialize_bytes_base64, -} - - -def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): - if annotation is int and rf and rf._format == "str": - return _deserialize_int_as_str - if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: - return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) - if rf and rf._format: - return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) - return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore - - -def _get_type_alias_type(module_name: str, alias_name: str): - types = { - k: v - for k, v in sys.modules[module_name].__dict__.items() - if isinstance(v, typing._GenericAlias) # type: ignore - } - if alias_name not in types: - return alias_name - return types[alias_name] - - -def _get_model(module_name: str, model_name: str): - models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} - module_end = module_name.rsplit(".", 1)[0] - models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) - if isinstance(model_name, str): - model_name = model_name.split(".")[-1] - if model_name not in models: - return model_name - return models[model_name] - - -_UNSET = object() - - -class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: dict[str, typing.Any]) -> None: - self._data = data - - def __contains__(self, key: typing.Any) -> bool: - return key in self._data - - def __getitem__(self, key: str) -> typing.Any: - # If this key has been deserialized (for mutable types), we need to handle serialization - if hasattr(self, "_attr_to_rest_field"): - cache_attr = f"_deserialized_{key}" - if hasattr(self, cache_attr): - rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) - if rf: - value = self._data.get(key) - if isinstance(value, (dict, list, set)): - # For mutable types, serialize and return - # But also update _data with serialized form and clear flag - # so mutations via this returned value affect _data - serialized = _serialize(value, rf._format) - # If serialized form is same type (no transformation needed), - # return _data directly so mutations work - if isinstance(serialized, type(value)) and serialized == value: - return self._data.get(key) - # Otherwise return serialized copy and clear flag - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - # Store serialized form back - self._data[key] = serialized - return serialized - return self._data.__getitem__(key) - - def __setitem__(self, key: str, value: typing.Any) -> None: - # Clear any cached deserialized value when setting through dictionary access - cache_attr = f"_deserialized_{key}" - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - self._data.__setitem__(key, value) - - def __delitem__(self, key: str) -> None: - self._data.__delitem__(key) - - def __iter__(self) -> typing.Iterator[typing.Any]: - return self._data.__iter__() - - def __len__(self) -> int: - return self._data.__len__() - - def __ne__(self, other: typing.Any) -> bool: - return not self.__eq__(other) - - def keys(self) -> typing.KeysView[str]: - """ - :returns: a set-like object providing a view on D's keys - :rtype: ~typing.KeysView - """ - return self._data.keys() - - def values(self) -> typing.ValuesView[typing.Any]: - """ - :returns: an object providing a view on D's values - :rtype: ~typing.ValuesView - """ - return self._data.values() - - def items(self) -> typing.ItemsView[str, typing.Any]: - """ - :returns: set-like object providing a view on D's items - :rtype: ~typing.ItemsView - """ - return self._data.items() - - def get(self, key: str, default: typing.Any = None) -> typing.Any: - """ - Get the value for key if key is in the dictionary, else default. - :param str key: The key to look up. - :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. - :rtype: any - """ - try: - return self[key] - except KeyError: - return default - - @typing.overload - def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ - - @typing.overload - def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs - - @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Removes specified key and return the corresponding value. - :param str key: The key to pop. - :param any default: The value to return if key is not in the dictionary - :returns: The value corresponding to the key. - :rtype: any - :raises KeyError: If key is not found and default is not given. - """ - if default is _UNSET: - return self._data.pop(key) - return self._data.pop(key, default) - - def popitem(self) -> tuple[str, typing.Any]: - """ - Removes and returns some (key, value) pair - :returns: The (key, value) pair. - :rtype: tuple - :raises KeyError: if D is empty. - """ - return self._data.popitem() - - def clear(self) -> None: - """ - Remove all items from D. - """ - self._data.clear() - - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ - """ - Updates D from mapping/iterable E and F. - :param any args: Either a mapping object or an iterable of key-value pairs. - """ - self._data.update(*args, **kwargs) - - @typing.overload - def setdefault(self, key: str, default: None = None) -> None: ... - - @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Same as calling D.get(k, d), and setting D[k]=d if k not found - :param str key: The key to look up. - :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. - :rtype: any - """ - if default is _UNSET: - return self._data.setdefault(key) - return self._data.setdefault(key, default) - - def __eq__(self, other: typing.Any) -> bool: - if isinstance(other, _MyMutableMapping): - return self._data == other._data - try: - other_model = self.__class__(other) - except Exception: - return False - return self._data == other_model._data - - def __repr__(self) -> str: - return str(self._data) - - -def _is_model(obj: typing.Any) -> bool: - return getattr(obj, "_is_model", False) - - -def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements - if isinstance(o, list): - if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): - return _ARRAY_ENCODE_MAPPING[format].join(o) - return [_serialize(x, format) for x in o] - if isinstance(o, dict): - return {k: _serialize(v, format) for k, v in o.items()} - if isinstance(o, set): - return {_serialize(x, format) for x in o} - if isinstance(o, tuple): - return tuple(_serialize(x, format) for x in o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, format) - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, enum.Enum): - return o.value - if isinstance(o, int): - if format == "str": - return str(o) - return o - try: - # First try datetime.datetime - return _serialize_datetime(o, format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return o - - -def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: - try: - return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) - except StopIteration: - return None - - -def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: - if not rf: - return _serialize(value, None) - if rf._is_multipart_file_input: - return value - if rf._is_model: - return _deserialize(rf._type, value) - if isinstance(value, ET.Element): - value = _deserialize(rf._type, value) - return _serialize(value, rf._format) - - -class Model(_MyMutableMapping): - _is_model = True - # label whether current class's _attr_to_rest_field has been calculated - # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: set[str] = set() - - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: - class_name = self.__class__.__name__ - if len(args) > 1: - raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } - if args: - if isinstance(args[0], ET.Element): - dict_to_pass.update(self._init_from_xml(args[0])) - else: - dict_to_pass.update( - {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} - ) - else: - non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] - if non_attr_kwargs: - # actual type errors only throw the first wrong keyword arg they see, so following that. - raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") - dict_to_pass.update( - { - self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) - for k, v in kwargs.items() - if v is not None - } - ) - super().__init__(dict_to_pass) - - def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: - """Deserialize an XML element into a dict mapping rest field names to values. - - :param ET.Element element: The XML element to deserialize from. - :returns: A dictionary of rest_name to deserialized value pairs. - :rtype: dict - """ - result: dict[str, typing.Any] = {} - model_meta = getattr(self, "_xml", {}) - existed_attr_keys: list[str] = [] - - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in element: - if e.tag not in existed_attr_keys: - result[e.tag] = _convert_element(e) - - return result - - def copy(self) -> "Model": - return Model(self.__dict__) - - 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' - mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property - k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") - } - annotations = { - k: v - for mro_class in mros - 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__ - if not rf._type: - rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) - if not rf._rest_name_input: - rf._rest_name_input = attr - cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) - cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - - return super().__new__(cls) - - def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: - for base in cls.__bases__: - if hasattr(base, "__mapping__"): - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore - - @classmethod - def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: - for v in cls.__dict__.values(): - if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: - return v - return None - - @classmethod - def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): - return cls(data) - discriminator = cls._get_discriminator(exist_discriminators) - if discriminator is None: - return cls(data) - exist_discriminators.append(discriminator._rest_name) - if isinstance(data, ET.Element): - model_meta = getattr(cls, "_xml", {}) - prop_meta = getattr(discriminator, "_xml", {}) - xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - if data.get(xml_name) is not None: - discriminator_value = data.get(xml_name) - else: - 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 - return mapped_cls._deserialize(data, exist_discriminators) - - def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: - """Return a dict that can be turned into json using json.dump. - - :keyword bool exclude_readonly: Whether to remove the readonly properties. - :returns: A dict JSON compatible object - :rtype: dict - """ - - result = {} - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] - for k, v in self.items(): - if exclude_readonly and k in readonly_props: # pyright: ignore - continue - is_multipart_file_input = False - try: - is_multipart_file_input = next( - rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k - )._is_multipart_file_input - except StopIteration: - pass - result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) - return result - - @staticmethod - def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: - if v is None or isinstance(v, _Null): - return None - if isinstance(v, (list, tuple, set)): - return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) - if isinstance(v, dict): - return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} - return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v - - -def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - - -def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - -def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - - -def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj: dict[typing.Any, typing.Any], -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = {child.tag: child for child in obj} - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - - -def _deserialize_multiple_sequence( - entry_deserializers: list[typing.Optional[typing.Callable]], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) - - -def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: - return ( - isinstance(deserializer, functools.partial) - and isinstance(deserializer.args[0], functools.partial) - and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable - ) - - -def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = list(obj) - - # encoded string may be deserialized to sequence - if isinstance(obj, str) and isinstance(deserializer, functools.partial): - # for list[str] - if _is_array_encoded_deserializer(deserializer): - return deserializer(obj) - - # for list[Union[...]] - if isinstance(deserializer.args[0], list): - for sub_deserializer in deserializer.args[0]: - if _is_array_encoded_deserializer(sub_deserializer): - return sub_deserializer(obj) - - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - -def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: - return sorted( - types, - key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), - ) - - -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches - annotation: typing.Any, - module: typing.Optional[str], - rf: typing.Optional["_RestField"] = None, -) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - if not annotation: - return None - - # is it a type alias? - if isinstance(annotation, str): - if module is not None: - annotation = _get_type_alias_type(module, annotation) - - # is it a forward ref / in quotes? - if isinstance(annotation, (str, typing.ForwardRef)): - try: - model_name = annotation.__forward_arg__ # type: ignore - except AttributeError: - model_name = annotation - if module is not None: - annotation = _get_model(module, model_name) # type: ignore - - try: - if module and _is_model(annotation): - if rf: - rf._is_model = True - - return functools.partial(_deserialize_model, annotation) # pyright: ignore - except Exception: - pass - - # is it a literal? - try: - if annotation.__origin__ is typing.Literal: # pyright: ignore - return None - except AttributeError: - pass - - # is it optional? - try: - if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore - if rf: - rf._is_optional = True - if len(annotation.__args__) <= 2: # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) - # the type is Optional[Union[...]], we need to remove the None type from the Union - annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore - return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) - except AttributeError: - pass - - # is it union? - if getattr(annotation, "__origin__", None) is typing.Union: - # initial ordering is we make `string` the last deserialization option, because it is often them most generic - deserializers = [ - _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in _sorted_annotations(annotation.__args__) # pyright: ignore - ] - - return functools.partial(_deserialize_with_union, deserializers) - - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() == "dict": - value_deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[1], module, rf # pyright: ignore - ) - - return functools.partial( - _deserialize_dict, - value_deserializer, - module, - ) - except (AttributeError, IndexError): - pass - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: - if len(annotation.__args__) > 1: # pyright: ignore - entry_deserializers = [ - _get_deserialize_callable_from_annotation(dt, module, rf) - for dt in annotation.__args__ # pyright: ignore - ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) - deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[0], module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_sequence, deserializer, module) - except (TypeError, IndexError, AttributeError, SyntaxError): - pass - - def _deserialize_default( - deserializer, - obj, - ): - if obj is None: - return obj - try: - return _deserialize_with_callable(deserializer, obj) - except Exception: - pass - return obj - - if get_deserializer(annotation, rf): - return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) - - return functools.partial(_deserialize_default, annotation) - - -def _deserialize_with_callable( - deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], - value: typing.Any, -): # pylint: disable=too-many-return-statements - try: - if value is None or isinstance(value, _Null): - return None - if isinstance(value, ET.Element): - if deserializer is str: - return value.text or "" - if deserializer is int: - return int(value.text) if value.text else None - if deserializer is float: - return float(value.text) if value.text else None - if deserializer is bool: - return value.text == "true" if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): - return deserializer(value.text) if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): - return deserializer(value.text) if value.text else None - if deserializer is None: - return value - if deserializer in [int, float, bool]: - return deserializer(value) - if isinstance(deserializer, CaseInsensitiveEnumMeta): - try: - return deserializer(value.text if isinstance(value, ET.Element) else value) - except ValueError: - # for unknown value, return raw value - return value.text if isinstance(value, ET.Element) else value - if isinstance(deserializer, type) and issubclass(deserializer, Model): - return deserializer._deserialize(value, []) - return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) - except Exception as e: - raise DeserializationError() from e - - -def _deserialize( - deserializer: typing.Any, - value: typing.Any, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - if isinstance(value, PipelineResponse): - value = value.http_response.json() - if rf is None and format: - rf = _RestField(format=format) - if not isinstance(deserializer, functools.partial): - deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) - return _deserialize_with_callable(deserializer, value) - - -def _failsafe_deserialize( - deserializer: typing.Any, - response: HttpResponse, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - try: - return _deserialize(deserializer, response.json(), module, rf, format) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -def _failsafe_deserialize_xml( - deserializer: typing.Any, - response: HttpResponse, -) -> typing.Any: - try: - return _deserialize_xml(deserializer, response.text()) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -# pylint: disable=too-many-instance-attributes -class _RestField: - def __init__( - self, - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - is_discriminator: bool = False, - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - ): - self._type = type - self._rest_name_input = name - self._module: typing.Optional[str] = None - self._is_discriminator = is_discriminator - self._visibility = visibility - self._is_model = False - self._is_optional = False - self._default = default - self._format = format - self._is_multipart_file_input = is_multipart_file_input - self._xml = xml if xml is not None else {} - - @property - def _class_type(self) -> typing.Any: - result = getattr(self._type, "args", [None])[0] - # type may be wrapped by nested functools.partial so we need to check for that - if isinstance(result, functools.partial): - return getattr(result, "args", [None])[0] - return result - - @property - def _rest_name(self) -> str: - if self._rest_name_input is None: - raise ValueError("Rest name was never set") - return self._rest_name_input - - def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin - # by this point, type and rest_name will have a value bc we default - # them in __new__ of the Model class - # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) - if item is None: - return item - if self._is_model: - return item - - # For mutable types, we want mutations to directly affect _data - # Check if we've already deserialized this value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - # Return the value from _data directly (it's been deserialized in place) - return obj._data.get(self._rest_name) - - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) - - # For mutable types, store the deserialized value back in _data - # so mutations directly affect _data - if isinstance(deserialized, (dict, list, set)): - obj._data[self._rest_name] = deserialized - object.__setattr__(obj, cache_attr, True) # Mark as deserialized - return deserialized - - return deserialized - - def __set__(self, obj: Model, value) -> None: - # Clear the cached deserialized object when setting a new value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - object.__delattr__(obj, cache_attr) - - if value is None: - # we want to wipe out entries if users set attr to None - try: - obj.__delitem__(self._rest_name) - except KeyError: - pass - return - if self._is_model: - if not _is_model(value): - value = _deserialize(self._type, value) - obj.__setitem__(self._rest_name, value) - return - obj.__setitem__(self._rest_name, _serialize(value, self._format)) - - def _get_deserialize_callable_from_annotation( - self, annotation: typing.Any - ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - return _get_deserialize_callable_from_annotation(annotation, self._module, self) - - -def rest_field( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField( - name=name, - type=type, - visibility=visibility, - default=default, - format=format, - is_multipart_file_input=is_multipart_file_input, - xml=xml, - ) - - -def rest_discriminator( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) - - -def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: - """Serialize a model to XML. - - :param Model model: The model to serialize. - :param bool exclude_readonly: Whether to exclude readonly properties. - :returns: The XML representation of the model. - :rtype: str - """ - return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore - - -def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: - """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. - - :param dict meta: The metadata dictionary to extract namespace from. - :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. - :rtype: str or None - """ - ns = meta.get("ns") - if ns is None: - ns = meta.get("namespace") - return ns - - -def _resolve_xml_ns( - prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None -) -> typing.Optional[str]: - """Resolve XML namespace for a property, falling back to model namespace when appropriate. - - Checks the property metadata first; if no namespace is found and the model does not declare - an explicit prefix, falls back to the model-level namespace. - - :param dict prop_meta: The property metadata dictionary. - :param dict model_meta: The model metadata dictionary, used as fallback. - :returns: The resolved namespace string, or None. - :rtype: str or None - """ - ns = _get_xml_ns(prop_meta) - if ns is None and model_meta is not None and not model_meta.get("prefix"): - ns = _get_xml_ns(model_meta) - return ns - - -def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: - """Set an XML attribute on an element, handling namespace prefix registration. - - :param ET.Element element: The element to set the attribute on. - :param str name: The default attribute name (wire name). - :param any value: The attribute value. - :param dict prop_meta: The property metadata dictionary. - """ - xml_name = prop_meta.get("name", name) - _attr_ns = _get_xml_ns(prop_meta) - if _attr_ns: - _attr_prefix = prop_meta.get("prefix") - if _attr_prefix: - _safe_register_namespace(_attr_prefix, _attr_ns) - xml_name = "{" + _attr_ns + "}" + xml_name - element.set(xml_name, _get_primitive_type_value(value)) - - -def _get_element( - o: typing.Any, - exclude_readonly: bool = False, - parent_meta: typing.Optional[dict[str, typing.Any]] = None, - wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, list[ET.Element]]: - if _is_model(o): - model_meta = getattr(o, "_xml", {}) - - # if prop is a model, then use the prop element directly, else generate a wrapper of model - if wrapped_element is None: - # When serializing as an array item (parent_meta is set), check if the parent has an - # explicit itemsName. This ensures correct element names for unwrapped arrays (where - # the element tag is the property/items name, not the model type name). - _items_name = parent_meta.get("itemsName") if parent_meta is not None else None - element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) - _model_ns = _get_xml_ns(model_meta) - wrapped_element = _create_xml_element( - element_name, - model_meta.get("prefix"), - _model_ns, - ) - - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - - for k, v in o.items(): - # do not serialize readonly properties - if exclude_readonly and k in readonly_props: - continue - - prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) - if prop_rest_field: - prop_meta = getattr(prop_rest_field, "_xml").copy() - # use the wire name as xml name if no specific name is set - if prop_meta.get("name") is None: - prop_meta["name"] = k - else: - # additional properties will not have rest field, use the wire name as xml name - prop_meta = {"name": k} - - # Propagate model namespace to properties only for old-style "ns"-keyed models. - # DPG-generated models use the "namespace" key and explicitly declare namespace on - # each property that needs it, so propagation is intentionally skipped for them. - if prop_meta.get("ns") is None and model_meta.get("ns"): - prop_meta["ns"] = model_meta.get("ns") - prop_meta["prefix"] = model_meta.get("prefix") - - if prop_meta.get("unwrapped", False): - # unwrapped could only set on array - wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) - elif prop_meta.get("text", False): - # text could only set on primitive type - wrapped_element.text = _get_primitive_type_value(v) - elif prop_meta.get("attribute", False): - _set_xml_attribute(wrapped_element, k, v, prop_meta) - else: - # other wrapped prop element - wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) - return wrapped_element - if isinstance(o, list): - return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore - if isinstance(o, dict): - result = [] - _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None - for k, v in o.items(): - result.append( - _get_wrapped_element( - v, - exclude_readonly, - { - "name": k, - "ns": _dict_ns, - "prefix": parent_meta.get("prefix") if parent_meta else None, - }, - ) - ) - return result - - # primitive case need to create element based on parent_meta - if parent_meta: - _items_ns = parent_meta.get("itemsNs") - if _items_ns is None: - _items_ns = _get_xml_ns(parent_meta) - return _get_wrapped_element( - o, - exclude_readonly, - { - "name": parent_meta.get("itemsName", parent_meta.get("name")), - "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": _items_ns, - }, - ) - - raise ValueError("Could not serialize value into xml: " + o) - - -def _get_wrapped_element( - v: typing.Any, - exclude_readonly: bool, - meta: typing.Optional[dict[str, typing.Any]], -) -> ET.Element: - _meta_ns = _get_xml_ns(meta) if meta else None - wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns - ) - if isinstance(v, (dict, list)): - wrapped_element.extend(_get_element(v, exclude_readonly, meta)) - elif _is_model(v): - _get_element(v, exclude_readonly, meta, wrapped_element) - else: - wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element # type: ignore[no-any-return] - - -def _get_primitive_type_value(v) -> str: - if v is True: - return "true" - if v is False: - return "false" - if isinstance(v, _Null): - return "" - return str(v) - - -def _safe_register_namespace(prefix: str, ns: str) -> None: - """Register an XML namespace prefix, handling reserved prefix patterns. - - Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for - auto-generated prefixes, causing register_namespace to raise ValueError. - Falls back to directly registering in the internal namespace map. - - :param str prefix: The namespace prefix to register. - :param str ns: The namespace URI. - """ - try: - ET.register_namespace(prefix, ns) - except ValueError: - _ns_map = getattr(ET, "_namespace_map", None) - if _ns_map is not None: - _ns_map[ns] = prefix - - -def _create_xml_element( - tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None -) -> ET.Element: - if prefix and ns: - _safe_register_namespace(prefix, ns) - if ns: - return ET.Element("{" + ns + "}" + tag) - return ET.Element(tag) - - -def _deserialize_xml( - deserializer: typing.Any, - value: str, -) -> typing.Any: - element = ET.fromstring(value) # nosec - return _deserialize(deserializer, element) - - -def _convert_element(e: ET.Element): - # dict case - if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: dict[str, typing.Any] = {} - for child in e: - if dict_result.get(child.tag) is not None: - if isinstance(dict_result[child.tag], list): - dict_result[child.tag].append(_convert_element(child)) - else: - dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] - else: - dict_result[child.tag] = _convert_element(child) - dict_result.update(e.attrib) - return dict_result - # array case - if len(e) > 0: - array_result: list[typing.Any] = [] - for child in e: - array_result.append(_convert_element(child)) - return array_result - # primitive case - return e.text diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_utils/serialization.py deleted file mode 100644 index 81ec1de5922b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_version.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_version.py deleted file mode 100644 index be71c81bd282..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b1" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/__init__.py deleted file mode 100644 index 436a7239a22f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import ServiceAClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServiceAClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/_client.py deleted file mode 100644 index e8a01b87377b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/_client.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable -from typing_extensions import Self - -from azure.core import AsyncPipelineClient -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .._utils.serialization import Deserializer, Serializer -from ..subnamespace.aio.operations import SubNamespaceOperations -from ._configuration import ServiceAClientConfiguration -from .operations import Operations - - -class ServiceAClient: - """First service definition in a multiple-services package with versioning. Without explicit - ``@client``, this should create a separate root client (``ServiceAClient``). - - :ivar sub_namespace: SubNamespaceOperations operations - :vartype sub_namespace: service.multipleservices.servicea.aio.operations.SubNamespaceOperations - :ivar operations: Operations operations - :vartype operations: service.multipleservices.servicea.aio.operations.Operations - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - :keyword api_version: Known values are "av2". Default value is "av2". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str or ~service.multipleservices.servicea.models.VersionsA - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = ServiceAClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - self.sub_namespace = SubNamespaceOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/_configuration.py deleted file mode 100644 index 5f5ea14616ad..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/_configuration.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from .._version import VERSION - - -class ServiceAClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ServiceAClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - :keyword api_version: Known values are "av2". Default value is "av2". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str or ~service.multipleservices.servicea.models.VersionsA - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "av2") - - self.endpoint = endpoint - self.api_version = api_version - kwargs.setdefault("sdk_moniker", "service-multipleservices-servicea/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/operations/__init__.py deleted file mode 100644 index 91e9291df9ea..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import Operations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/operations/_operations.py deleted file mode 100644 index 3c96ceea7aa6..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/operations/_operations.py +++ /dev/null @@ -1,92 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async - -from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_operations_op_a_request -from .._configuration import ServiceAClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~service.multipleservices.servicea.aio.ServiceAClient`'s - :attr:`operations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ServiceAClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def op_a(self, **kwargs: Any) -> None: - """op_a. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_operations_op_a_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/aio/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/models/__init__.py deleted file mode 100644 index 1d30d3b32772..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/models/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._enums import ( # type: ignore - VersionsA, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "VersionsA", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/models/_enums.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/models/_enums.py deleted file mode 100644 index e54305ed9d83..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/models/_enums.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class VersionsA(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of VersionsA.""" - - AV1 = "av1" - """AV1.""" - AV2 = "av2" - """AV2.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/models/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/operations/__init__.py deleted file mode 100644 index 91e9291df9ea..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import Operations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/operations/_operations.py deleted file mode 100644 index 22d37c9492e1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/operations/_operations.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .._configuration import ServiceAClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_operations_op_a_request(**kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "av2")) - # Construct URL - _url = "/service/multiple-services/service-a/a-test" - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~service.multipleservices.servicea.ServiceAClient`'s - :attr:`operations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ServiceAClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def op_a(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """op_a. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_operations_op_a_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/py.typed b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/operations/__init__.py deleted file mode 100644 index 7600403fdead..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import SubNamespaceOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SubNamespaceOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/operations/_operations.py deleted file mode 100644 index 208565965e0d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/operations/_operations.py +++ /dev/null @@ -1,92 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async - -from ...._utils.serialization import Deserializer, Serializer -from ....aio._configuration import ServiceAClientConfiguration -from ...operations._operations import build_sub_namespace_sub_op_a_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class SubNamespaceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~service.multipleservices.servicea.aio.ServiceAClient`'s - :attr:`sub_namespace` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ServiceAClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def sub_op_a(self, **kwargs: Any) -> None: - """sub_op_a. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_sub_namespace_sub_op_a_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/aio/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/operations/__init__.py deleted file mode 100644 index 7600403fdead..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import SubNamespaceOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SubNamespaceOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/operations/_operations.py deleted file mode 100644 index 55441cf0ced3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/operations/_operations.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from ..._configuration import ServiceAClientConfiguration -from ..._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_sub_namespace_sub_op_a_request(**kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "av2")) - # Construct URL - _url = "/service/multiple-services/service-a/a-sub-test" - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -class SubNamespaceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~service.multipleservices.servicea.ServiceAClient`'s - :attr:`sub_namespace` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ServiceAClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def sub_op_a(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """sub_op_a. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_sub_namespace_sub_op_a_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/servicea/subnamespace/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/__init__.py deleted file mode 100644 index a560693425e3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import ServiceBClient # type: ignore -from ..servicea._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServiceBClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_client.py deleted file mode 100644 index c0037584b576..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_client.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any -from typing_extensions import Self - -from azure.core import PipelineClient -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse - -from ..servicea._utils.serialization import Deserializer, Serializer -from ._configuration import ServiceBClientConfiguration -from .operations import Operations -from .subnamespace.operations import SubNamespaceOperations - - -class ServiceBClient: - """Second service definition in a multiple-services package with versioning. Without explicit - ``@client``, this should create a separate root client (``ServiceBClient``). - - :ivar sub_namespace: SubNamespaceOperations operations - :vartype sub_namespace: service.multipleservices.servicea.operations.SubNamespaceOperations - :ivar operations: Operations operations - :vartype operations: service.multipleservices.servicea.operations.Operations - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - :keyword api_version: Known values are "bv2". Default value is "bv2". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str or ~service.multipleservices.serviceb.models.VersionsB - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = ServiceBClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - self.sub_namespace = SubNamespaceOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_configuration.py deleted file mode 100644 index 7f3d9b5fcbe2..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_configuration.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from ..servicea._version import VERSION - - -class ServiceBClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ServiceBClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - :keyword api_version: Known values are "bv2". Default value is "bv2". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str or ~service.multipleservices.serviceb.models.VersionsB - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "bv2") - - self.endpoint = endpoint - self.api_version = api_version - kwargs.setdefault("sdk_moniker", "service-multipleservices-servicea/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_utils/__init__.py deleted file mode 100644 index 8026245c2abc..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_utils/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_utils/model_base.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_utils/model_base.py deleted file mode 100644 index db24930fdca9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_utils/model_base.py +++ /dev/null @@ -1,1441 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=protected-access, broad-except - -import copy -import calendar -import decimal -import functools -import sys -import logging -import base64 -import re -import typing -import enum -import email.utils -from datetime import datetime, date, time, timedelta, timezone -from json import JSONEncoder -import xml.etree.ElementTree as ET -from collections.abc import MutableMapping -from typing_extensions import Self -import isodate -from azure.core.exceptions import DeserializationError -from azure.core import CaseInsensitiveEnumMeta -from azure.core.pipeline import PipelineResponse -from azure.core.serialization import _Null -from azure.core.rest import HttpResponse - -_LOGGER = logging.getLogger(__name__) - -__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] - -TZ_UTC = timezone.utc -_T = typing.TypeVar("_T") -_NONE_TYPE = type(None) - - -def _timedelta_as_isostr(td: timedelta) -> str: - """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' - - Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython - - :param timedelta td: The timedelta to convert - :rtype: str - :return: ISO8601 version of this timedelta - """ - - # Split seconds to larger units - seconds = td.total_seconds() - minutes, seconds = divmod(seconds, 60) - hours, minutes = divmod(minutes, 60) - days, hours = divmod(hours, 24) - - days, hours, minutes = list(map(int, (days, hours, minutes))) - seconds = round(seconds, 6) - - # Build date - date_str = "" - if days: - date_str = "%sD" % days - - if hours or minutes or seconds: - # Build time - time_str = "T" - - # Hours - bigger_exists = date_str or hours - if bigger_exists: - time_str += "{:02}H".format(hours) - - # Minutes - bigger_exists = bigger_exists or minutes - if bigger_exists: - time_str += "{:02}M".format(minutes) - - # Seconds - try: - if seconds.is_integer(): - seconds_string = "{:02}".format(int(seconds)) - else: - # 9 chars long w/ leading 0, 6 digits after decimal - seconds_string = "%09.6f" % seconds - # Remove trailing zeros - seconds_string = seconds_string.rstrip("0") - except AttributeError: # int.is_integer() raises - seconds_string = "{:02}".format(seconds) - - time_str += "{}S".format(seconds_string) - else: - time_str = "" - - return "P" + date_str + time_str - - -def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: - encoded = base64.b64encode(o).decode() - if format == "base64url": - return encoded.strip("=").replace("+", "-").replace("/", "_") - return encoded - - -def _serialize_datetime(o, format: typing.Optional[str] = None): - if hasattr(o, "year") and hasattr(o, "hour"): - if format == "rfc7231": - return email.utils.format_datetime(o, usegmt=True) - if format == "unix-timestamp": - return int(calendar.timegm(o.utctimetuple())) - - # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) - if not o.tzinfo: - iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() - else: - iso_formatted = o.astimezone(TZ_UTC).isoformat() - # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) - return iso_formatted.replace("+00:00", "Z") - # Next try datetime.date or datetime.time - return o.isoformat() - - -def _is_readonly(p): - try: - return p._visibility == ["read"] - except AttributeError: - return False - - -class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" - - def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): - super().__init__(*args, **kwargs) - self.exclude_readonly = exclude_readonly - self.format = format - - def default(self, o): # pylint: disable=too-many-return-statements - if _is_model(o): - if self.exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - return {k: v for k, v in o.items() if k not in readonly_props} - return dict(o.items()) - try: - return super(SdkJSONEncoder, self).default(o) - except TypeError: - if isinstance(o, _Null): - return None - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, self.format) - try: - # First try datetime.datetime - return _serialize_datetime(o, self.format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return super(SdkJSONEncoder, self).default(o) - - -_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") -_VALID_RFC7231 = re.compile( - r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" - r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" -) - -_ARRAY_ENCODE_MAPPING = { - "pipeDelimited": "|", - "spaceDelimited": " ", - "commaDelimited": ",", - "newlineDelimited": "\n", -} - - -def _deserialize_array_encoded(delimit: str, attr): - if isinstance(attr, str): - if attr == "": - return [] - return attr.split(delimit) - return attr - - -def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - attr = attr.upper() - match = _VALID_DATE.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - return date_obj # type: ignore[no-any-return] - - -def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize RFC7231 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - match = _VALID_RFC7231.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - return email.utils.parsedate_to_datetime(attr) - - -def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: - """Deserialize unix timestamp into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - return datetime.fromtimestamp(attr, TZ_UTC) - - -def _deserialize_date(attr: typing.Union[str, date]) -> date: - """Deserialize ISO-8601 formatted string into Date object. - :param str attr: response string to be deserialized. - :rtype: date - :returns: The date object from that input - """ - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - if isinstance(attr, date): - return attr - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore - - -def _deserialize_time(attr: typing.Union[str, time]) -> time: - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :returns: The time object from that input - """ - if isinstance(attr, time): - return attr - return isodate.parse_time(attr) # type: ignore[no-any-return] - - -def _deserialize_bytes(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - return bytes(base64.b64decode(attr)) - - -def _deserialize_bytes_base64(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return bytes(base64.b64decode(encoded)) - - -def _deserialize_duration(attr): - if isinstance(attr, timedelta): - return attr - return isodate.parse_duration(attr) - - -def _deserialize_decimal(attr): - if isinstance(attr, decimal.Decimal): - return attr - return decimal.Decimal(str(attr)) - - -def _deserialize_int_as_str(attr): - if isinstance(attr, int): - return attr - return int(attr) - - -_DESERIALIZE_MAPPING = { - datetime: _deserialize_datetime, - date: _deserialize_date, - time: _deserialize_time, - bytes: _deserialize_bytes, - bytearray: _deserialize_bytes, - timedelta: _deserialize_duration, - typing.Any: lambda x: x, - decimal.Decimal: _deserialize_decimal, -} - -_DESERIALIZE_MAPPING_WITHFORMAT = { - "rfc3339": _deserialize_datetime, - "rfc7231": _deserialize_datetime_rfc7231, - "unix-timestamp": _deserialize_datetime_unix_timestamp, - "base64": _deserialize_bytes, - "base64url": _deserialize_bytes_base64, -} - - -def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): - if annotation is int and rf and rf._format == "str": - return _deserialize_int_as_str - if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: - return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) - if rf and rf._format: - return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) - return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore - - -def _get_type_alias_type(module_name: str, alias_name: str): - types = { - k: v - for k, v in sys.modules[module_name].__dict__.items() - if isinstance(v, typing._GenericAlias) # type: ignore - } - if alias_name not in types: - return alias_name - return types[alias_name] - - -def _get_model(module_name: str, model_name: str): - models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} - module_end = module_name.rsplit(".", 1)[0] - models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) - if isinstance(model_name, str): - model_name = model_name.split(".")[-1] - if model_name not in models: - return model_name - return models[model_name] - - -_UNSET = object() - - -class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: dict[str, typing.Any]) -> None: - self._data = data - - def __contains__(self, key: typing.Any) -> bool: - return key in self._data - - def __getitem__(self, key: str) -> typing.Any: - # If this key has been deserialized (for mutable types), we need to handle serialization - if hasattr(self, "_attr_to_rest_field"): - cache_attr = f"_deserialized_{key}" - if hasattr(self, cache_attr): - rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) - if rf: - value = self._data.get(key) - if isinstance(value, (dict, list, set)): - # For mutable types, serialize and return - # But also update _data with serialized form and clear flag - # so mutations via this returned value affect _data - serialized = _serialize(value, rf._format) - # If serialized form is same type (no transformation needed), - # return _data directly so mutations work - if isinstance(serialized, type(value)) and serialized == value: - return self._data.get(key) - # Otherwise return serialized copy and clear flag - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - # Store serialized form back - self._data[key] = serialized - return serialized - return self._data.__getitem__(key) - - def __setitem__(self, key: str, value: typing.Any) -> None: - # Clear any cached deserialized value when setting through dictionary access - cache_attr = f"_deserialized_{key}" - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - self._data.__setitem__(key, value) - - def __delitem__(self, key: str) -> None: - self._data.__delitem__(key) - - def __iter__(self) -> typing.Iterator[typing.Any]: - return self._data.__iter__() - - def __len__(self) -> int: - return self._data.__len__() - - def __ne__(self, other: typing.Any) -> bool: - return not self.__eq__(other) - - def keys(self) -> typing.KeysView[str]: - """ - :returns: a set-like object providing a view on D's keys - :rtype: ~typing.KeysView - """ - return self._data.keys() - - def values(self) -> typing.ValuesView[typing.Any]: - """ - :returns: an object providing a view on D's values - :rtype: ~typing.ValuesView - """ - return self._data.values() - - def items(self) -> typing.ItemsView[str, typing.Any]: - """ - :returns: set-like object providing a view on D's items - :rtype: ~typing.ItemsView - """ - return self._data.items() - - def get(self, key: str, default: typing.Any = None) -> typing.Any: - """ - Get the value for key if key is in the dictionary, else default. - :param str key: The key to look up. - :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. - :rtype: any - """ - try: - return self[key] - except KeyError: - return default - - @typing.overload - def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ - - @typing.overload - def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs - - @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Removes specified key and return the corresponding value. - :param str key: The key to pop. - :param any default: The value to return if key is not in the dictionary - :returns: The value corresponding to the key. - :rtype: any - :raises KeyError: If key is not found and default is not given. - """ - if default is _UNSET: - return self._data.pop(key) - return self._data.pop(key, default) - - def popitem(self) -> tuple[str, typing.Any]: - """ - Removes and returns some (key, value) pair - :returns: The (key, value) pair. - :rtype: tuple - :raises KeyError: if D is empty. - """ - return self._data.popitem() - - def clear(self) -> None: - """ - Remove all items from D. - """ - self._data.clear() - - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ - """ - Updates D from mapping/iterable E and F. - :param any args: Either a mapping object or an iterable of key-value pairs. - """ - self._data.update(*args, **kwargs) - - @typing.overload - def setdefault(self, key: str, default: None = None) -> None: ... - - @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Same as calling D.get(k, d), and setting D[k]=d if k not found - :param str key: The key to look up. - :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. - :rtype: any - """ - if default is _UNSET: - return self._data.setdefault(key) - return self._data.setdefault(key, default) - - def __eq__(self, other: typing.Any) -> bool: - if isinstance(other, _MyMutableMapping): - return self._data == other._data - try: - other_model = self.__class__(other) - except Exception: - return False - return self._data == other_model._data - - def __repr__(self) -> str: - return str(self._data) - - -def _is_model(obj: typing.Any) -> bool: - return getattr(obj, "_is_model", False) - - -def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements - if isinstance(o, list): - if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): - return _ARRAY_ENCODE_MAPPING[format].join(o) - return [_serialize(x, format) for x in o] - if isinstance(o, dict): - return {k: _serialize(v, format) for k, v in o.items()} - if isinstance(o, set): - return {_serialize(x, format) for x in o} - if isinstance(o, tuple): - return tuple(_serialize(x, format) for x in o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, format) - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, enum.Enum): - return o.value - if isinstance(o, int): - if format == "str": - return str(o) - return o - try: - # First try datetime.datetime - return _serialize_datetime(o, format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return o - - -def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: - try: - return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) - except StopIteration: - return None - - -def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: - if not rf: - return _serialize(value, None) - if rf._is_multipart_file_input: - return value - if rf._is_model: - return _deserialize(rf._type, value) - if isinstance(value, ET.Element): - value = _deserialize(rf._type, value) - return _serialize(value, rf._format) - - -class Model(_MyMutableMapping): - _is_model = True - # label whether current class's _attr_to_rest_field has been calculated - # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: set[str] = set() - - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: - class_name = self.__class__.__name__ - if len(args) > 1: - raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } - if args: - if isinstance(args[0], ET.Element): - dict_to_pass.update(self._init_from_xml(args[0])) - else: - dict_to_pass.update( - {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} - ) - else: - non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] - if non_attr_kwargs: - # actual type errors only throw the first wrong keyword arg they see, so following that. - raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") - dict_to_pass.update( - { - self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) - for k, v in kwargs.items() - if v is not None - } - ) - super().__init__(dict_to_pass) - - def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: - """Deserialize an XML element into a dict mapping rest field names to values. - - :param ET.Element element: The XML element to deserialize from. - :returns: A dictionary of rest_name to deserialized value pairs. - :rtype: dict - """ - result: dict[str, typing.Any] = {} - model_meta = getattr(self, "_xml", {}) - existed_attr_keys: list[str] = [] - - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in element: - if e.tag not in existed_attr_keys: - result[e.tag] = _convert_element(e) - - return result - - def copy(self) -> "Model": - return Model(self.__dict__) - - 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' - mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property - k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") - } - annotations = { - k: v - for mro_class in mros - 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__ - if not rf._type: - rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) - if not rf._rest_name_input: - rf._rest_name_input = attr - cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) - cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - - return super().__new__(cls) - - def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: - for base in cls.__bases__: - if hasattr(base, "__mapping__"): - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore - - @classmethod - def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: - for v in cls.__dict__.values(): - if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: - return v - return None - - @classmethod - def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): - return cls(data) - discriminator = cls._get_discriminator(exist_discriminators) - if discriminator is None: - return cls(data) - exist_discriminators.append(discriminator._rest_name) - if isinstance(data, ET.Element): - model_meta = getattr(cls, "_xml", {}) - prop_meta = getattr(discriminator, "_xml", {}) - xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - if data.get(xml_name) is not None: - discriminator_value = data.get(xml_name) - else: - 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 - return mapped_cls._deserialize(data, exist_discriminators) - - def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: - """Return a dict that can be turned into json using json.dump. - - :keyword bool exclude_readonly: Whether to remove the readonly properties. - :returns: A dict JSON compatible object - :rtype: dict - """ - - result = {} - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] - for k, v in self.items(): - if exclude_readonly and k in readonly_props: # pyright: ignore - continue - is_multipart_file_input = False - try: - is_multipart_file_input = next( - rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k - )._is_multipart_file_input - except StopIteration: - pass - result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) - return result - - @staticmethod - def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: - if v is None or isinstance(v, _Null): - return None - if isinstance(v, (list, tuple, set)): - return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) - if isinstance(v, dict): - return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} - return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v - - -def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - - -def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - -def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - - -def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj: dict[typing.Any, typing.Any], -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = {child.tag: child for child in obj} - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - - -def _deserialize_multiple_sequence( - entry_deserializers: list[typing.Optional[typing.Callable]], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) - - -def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: - return ( - isinstance(deserializer, functools.partial) - and isinstance(deserializer.args[0], functools.partial) - and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable - ) - - -def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = list(obj) - - # encoded string may be deserialized to sequence - if isinstance(obj, str) and isinstance(deserializer, functools.partial): - # for list[str] - if _is_array_encoded_deserializer(deserializer): - return deserializer(obj) - - # for list[Union[...]] - if isinstance(deserializer.args[0], list): - for sub_deserializer in deserializer.args[0]: - if _is_array_encoded_deserializer(sub_deserializer): - return sub_deserializer(obj) - - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - -def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: - return sorted( - types, - key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), - ) - - -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches - annotation: typing.Any, - module: typing.Optional[str], - rf: typing.Optional["_RestField"] = None, -) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - if not annotation: - return None - - # is it a type alias? - if isinstance(annotation, str): - if module is not None: - annotation = _get_type_alias_type(module, annotation) - - # is it a forward ref / in quotes? - if isinstance(annotation, (str, typing.ForwardRef)): - try: - model_name = annotation.__forward_arg__ # type: ignore - except AttributeError: - model_name = annotation - if module is not None: - annotation = _get_model(module, model_name) # type: ignore - - try: - if module and _is_model(annotation): - if rf: - rf._is_model = True - - return functools.partial(_deserialize_model, annotation) # pyright: ignore - except Exception: - pass - - # is it a literal? - try: - if annotation.__origin__ is typing.Literal: # pyright: ignore - return None - except AttributeError: - pass - - # is it optional? - try: - if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore - if rf: - rf._is_optional = True - if len(annotation.__args__) <= 2: # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) - # the type is Optional[Union[...]], we need to remove the None type from the Union - annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore - return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) - except AttributeError: - pass - - # is it union? - if getattr(annotation, "__origin__", None) is typing.Union: - # initial ordering is we make `string` the last deserialization option, because it is often them most generic - deserializers = [ - _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in _sorted_annotations(annotation.__args__) # pyright: ignore - ] - - return functools.partial(_deserialize_with_union, deserializers) - - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() == "dict": - value_deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[1], module, rf # pyright: ignore - ) - - return functools.partial( - _deserialize_dict, - value_deserializer, - module, - ) - except (AttributeError, IndexError): - pass - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: - if len(annotation.__args__) > 1: # pyright: ignore - entry_deserializers = [ - _get_deserialize_callable_from_annotation(dt, module, rf) - for dt in annotation.__args__ # pyright: ignore - ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) - deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[0], module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_sequence, deserializer, module) - except (TypeError, IndexError, AttributeError, SyntaxError): - pass - - def _deserialize_default( - deserializer, - obj, - ): - if obj is None: - return obj - try: - return _deserialize_with_callable(deserializer, obj) - except Exception: - pass - return obj - - if get_deserializer(annotation, rf): - return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) - - return functools.partial(_deserialize_default, annotation) - - -def _deserialize_with_callable( - deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], - value: typing.Any, -): # pylint: disable=too-many-return-statements - try: - if value is None or isinstance(value, _Null): - return None - if isinstance(value, ET.Element): - if deserializer is str: - return value.text or "" - if deserializer is int: - return int(value.text) if value.text else None - if deserializer is float: - return float(value.text) if value.text else None - if deserializer is bool: - return value.text == "true" if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): - return deserializer(value.text) if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): - return deserializer(value.text) if value.text else None - if deserializer is None: - return value - if deserializer in [int, float, bool]: - return deserializer(value) - if isinstance(deserializer, CaseInsensitiveEnumMeta): - try: - return deserializer(value.text if isinstance(value, ET.Element) else value) - except ValueError: - # for unknown value, return raw value - return value.text if isinstance(value, ET.Element) else value - if isinstance(deserializer, type) and issubclass(deserializer, Model): - return deserializer._deserialize(value, []) - return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) - except Exception as e: - raise DeserializationError() from e - - -def _deserialize( - deserializer: typing.Any, - value: typing.Any, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - if isinstance(value, PipelineResponse): - value = value.http_response.json() - if rf is None and format: - rf = _RestField(format=format) - if not isinstance(deserializer, functools.partial): - deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) - return _deserialize_with_callable(deserializer, value) - - -def _failsafe_deserialize( - deserializer: typing.Any, - response: HttpResponse, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - try: - return _deserialize(deserializer, response.json(), module, rf, format) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -def _failsafe_deserialize_xml( - deserializer: typing.Any, - response: HttpResponse, -) -> typing.Any: - try: - return _deserialize_xml(deserializer, response.text()) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -# pylint: disable=too-many-instance-attributes -class _RestField: - def __init__( - self, - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - is_discriminator: bool = False, - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - ): - self._type = type - self._rest_name_input = name - self._module: typing.Optional[str] = None - self._is_discriminator = is_discriminator - self._visibility = visibility - self._is_model = False - self._is_optional = False - self._default = default - self._format = format - self._is_multipart_file_input = is_multipart_file_input - self._xml = xml if xml is not None else {} - - @property - def _class_type(self) -> typing.Any: - result = getattr(self._type, "args", [None])[0] - # type may be wrapped by nested functools.partial so we need to check for that - if isinstance(result, functools.partial): - return getattr(result, "args", [None])[0] - return result - - @property - def _rest_name(self) -> str: - if self._rest_name_input is None: - raise ValueError("Rest name was never set") - return self._rest_name_input - - def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin - # by this point, type and rest_name will have a value bc we default - # them in __new__ of the Model class - # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) - if item is None: - return item - if self._is_model: - return item - - # For mutable types, we want mutations to directly affect _data - # Check if we've already deserialized this value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - # Return the value from _data directly (it's been deserialized in place) - return obj._data.get(self._rest_name) - - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) - - # For mutable types, store the deserialized value back in _data - # so mutations directly affect _data - if isinstance(deserialized, (dict, list, set)): - obj._data[self._rest_name] = deserialized - object.__setattr__(obj, cache_attr, True) # Mark as deserialized - return deserialized - - return deserialized - - def __set__(self, obj: Model, value) -> None: - # Clear the cached deserialized object when setting a new value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - object.__delattr__(obj, cache_attr) - - if value is None: - # we want to wipe out entries if users set attr to None - try: - obj.__delitem__(self._rest_name) - except KeyError: - pass - return - if self._is_model: - if not _is_model(value): - value = _deserialize(self._type, value) - obj.__setitem__(self._rest_name, value) - return - obj.__setitem__(self._rest_name, _serialize(value, self._format)) - - def _get_deserialize_callable_from_annotation( - self, annotation: typing.Any - ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - return _get_deserialize_callable_from_annotation(annotation, self._module, self) - - -def rest_field( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField( - name=name, - type=type, - visibility=visibility, - default=default, - format=format, - is_multipart_file_input=is_multipart_file_input, - xml=xml, - ) - - -def rest_discriminator( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) - - -def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: - """Serialize a model to XML. - - :param Model model: The model to serialize. - :param bool exclude_readonly: Whether to exclude readonly properties. - :returns: The XML representation of the model. - :rtype: str - """ - return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore - - -def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: - """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. - - :param dict meta: The metadata dictionary to extract namespace from. - :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. - :rtype: str or None - """ - ns = meta.get("ns") - if ns is None: - ns = meta.get("namespace") - return ns - - -def _resolve_xml_ns( - prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None -) -> typing.Optional[str]: - """Resolve XML namespace for a property, falling back to model namespace when appropriate. - - Checks the property metadata first; if no namespace is found and the model does not declare - an explicit prefix, falls back to the model-level namespace. - - :param dict prop_meta: The property metadata dictionary. - :param dict model_meta: The model metadata dictionary, used as fallback. - :returns: The resolved namespace string, or None. - :rtype: str or None - """ - ns = _get_xml_ns(prop_meta) - if ns is None and model_meta is not None and not model_meta.get("prefix"): - ns = _get_xml_ns(model_meta) - return ns - - -def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: - """Set an XML attribute on an element, handling namespace prefix registration. - - :param ET.Element element: The element to set the attribute on. - :param str name: The default attribute name (wire name). - :param any value: The attribute value. - :param dict prop_meta: The property metadata dictionary. - """ - xml_name = prop_meta.get("name", name) - _attr_ns = _get_xml_ns(prop_meta) - if _attr_ns: - _attr_prefix = prop_meta.get("prefix") - if _attr_prefix: - _safe_register_namespace(_attr_prefix, _attr_ns) - xml_name = "{" + _attr_ns + "}" + xml_name - element.set(xml_name, _get_primitive_type_value(value)) - - -def _get_element( - o: typing.Any, - exclude_readonly: bool = False, - parent_meta: typing.Optional[dict[str, typing.Any]] = None, - wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, list[ET.Element]]: - if _is_model(o): - model_meta = getattr(o, "_xml", {}) - - # if prop is a model, then use the prop element directly, else generate a wrapper of model - if wrapped_element is None: - # When serializing as an array item (parent_meta is set), check if the parent has an - # explicit itemsName. This ensures correct element names for unwrapped arrays (where - # the element tag is the property/items name, not the model type name). - _items_name = parent_meta.get("itemsName") if parent_meta is not None else None - element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) - _model_ns = _get_xml_ns(model_meta) - wrapped_element = _create_xml_element( - element_name, - model_meta.get("prefix"), - _model_ns, - ) - - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - - for k, v in o.items(): - # do not serialize readonly properties - if exclude_readonly and k in readonly_props: - continue - - prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) - if prop_rest_field: - prop_meta = getattr(prop_rest_field, "_xml").copy() - # use the wire name as xml name if no specific name is set - if prop_meta.get("name") is None: - prop_meta["name"] = k - else: - # additional properties will not have rest field, use the wire name as xml name - prop_meta = {"name": k} - - # Propagate model namespace to properties only for old-style "ns"-keyed models. - # DPG-generated models use the "namespace" key and explicitly declare namespace on - # each property that needs it, so propagation is intentionally skipped for them. - if prop_meta.get("ns") is None and model_meta.get("ns"): - prop_meta["ns"] = model_meta.get("ns") - prop_meta["prefix"] = model_meta.get("prefix") - - if prop_meta.get("unwrapped", False): - # unwrapped could only set on array - wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) - elif prop_meta.get("text", False): - # text could only set on primitive type - wrapped_element.text = _get_primitive_type_value(v) - elif prop_meta.get("attribute", False): - _set_xml_attribute(wrapped_element, k, v, prop_meta) - else: - # other wrapped prop element - wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) - return wrapped_element - if isinstance(o, list): - return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore - if isinstance(o, dict): - result = [] - _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None - for k, v in o.items(): - result.append( - _get_wrapped_element( - v, - exclude_readonly, - { - "name": k, - "ns": _dict_ns, - "prefix": parent_meta.get("prefix") if parent_meta else None, - }, - ) - ) - return result - - # primitive case need to create element based on parent_meta - if parent_meta: - _items_ns = parent_meta.get("itemsNs") - if _items_ns is None: - _items_ns = _get_xml_ns(parent_meta) - return _get_wrapped_element( - o, - exclude_readonly, - { - "name": parent_meta.get("itemsName", parent_meta.get("name")), - "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": _items_ns, - }, - ) - - raise ValueError("Could not serialize value into xml: " + o) - - -def _get_wrapped_element( - v: typing.Any, - exclude_readonly: bool, - meta: typing.Optional[dict[str, typing.Any]], -) -> ET.Element: - _meta_ns = _get_xml_ns(meta) if meta else None - wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns - ) - if isinstance(v, (dict, list)): - wrapped_element.extend(_get_element(v, exclude_readonly, meta)) - elif _is_model(v): - _get_element(v, exclude_readonly, meta, wrapped_element) - else: - wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element # type: ignore[no-any-return] - - -def _get_primitive_type_value(v) -> str: - if v is True: - return "true" - if v is False: - return "false" - if isinstance(v, _Null): - return "" - return str(v) - - -def _safe_register_namespace(prefix: str, ns: str) -> None: - """Register an XML namespace prefix, handling reserved prefix patterns. - - Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for - auto-generated prefixes, causing register_namespace to raise ValueError. - Falls back to directly registering in the internal namespace map. - - :param str prefix: The namespace prefix to register. - :param str ns: The namespace URI. - """ - try: - ET.register_namespace(prefix, ns) - except ValueError: - _ns_map = getattr(ET, "_namespace_map", None) - if _ns_map is not None: - _ns_map[ns] = prefix - - -def _create_xml_element( - tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None -) -> ET.Element: - if prefix and ns: - _safe_register_namespace(prefix, ns) - if ns: - return ET.Element("{" + ns + "}" + tag) - return ET.Element(tag) - - -def _deserialize_xml( - deserializer: typing.Any, - value: str, -) -> typing.Any: - element = ET.fromstring(value) # nosec - return _deserialize(deserializer, element) - - -def _convert_element(e: ET.Element): - # dict case - if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: dict[str, typing.Any] = {} - for child in e: - if dict_result.get(child.tag) is not None: - if isinstance(dict_result[child.tag], list): - dict_result[child.tag].append(_convert_element(child)) - else: - dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] - else: - dict_result[child.tag] = _convert_element(child) - dict_result.update(e.attrib) - return dict_result - # array case - if len(e) > 0: - array_result: list[typing.Any] = [] - for child in e: - array_result.append(_convert_element(child)) - return array_result - # primitive case - return e.text diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_utils/serialization.py deleted file mode 100644 index 81ec1de5922b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/__init__.py deleted file mode 100644 index a3b525ade616..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import ServiceBClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ServiceBClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/_client.py deleted file mode 100644 index 3521dc4f1950..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/_client.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable -from typing_extensions import Self - -from azure.core import AsyncPipelineClient -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from ...servicea._utils.serialization import Deserializer, Serializer -from ..subnamespace.aio.operations import SubNamespaceOperations -from ._configuration import ServiceBClientConfiguration -from .operations import Operations - - -class ServiceBClient: - """Second service definition in a multiple-services package with versioning. Without explicit - ``@client``, this should create a separate root client (``ServiceBClient``). - - :ivar sub_namespace: SubNamespaceOperations operations - :vartype sub_namespace: service.multipleservices.servicea.aio.operations.SubNamespaceOperations - :ivar operations: Operations operations - :vartype operations: service.multipleservices.servicea.aio.operations.Operations - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - :keyword api_version: Known values are "bv2". Default value is "bv2". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str or ~service.multipleservices.serviceb.models.VersionsB - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = ServiceBClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - self.sub_namespace = SubNamespaceOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/_configuration.py deleted file mode 100644 index a604e664ae13..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/_configuration.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from ...servicea._version import VERSION - - -class ServiceBClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ServiceBClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - :keyword api_version: Known values are "bv2". Default value is "bv2". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str or ~service.multipleservices.serviceb.models.VersionsB - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "bv2") - - self.endpoint = endpoint - self.api_version = api_version - kwargs.setdefault("sdk_moniker", "service-multipleservices-servicea/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/operations/__init__.py deleted file mode 100644 index 91e9291df9ea..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import Operations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/operations/_operations.py deleted file mode 100644 index 08ca9c18cb95..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/operations/_operations.py +++ /dev/null @@ -1,92 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async - -from ....servicea._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_operations_op_b_request -from .._configuration import ServiceBClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~service.multipleservices.servicea.aio.ServiceBClient`'s - :attr:`operations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ServiceBClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def op_b(self, **kwargs: Any) -> None: - """op_b. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_operations_op_b_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/aio/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/models/__init__.py deleted file mode 100644 index 4ce8824590a6..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/models/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._enums import ( # type: ignore - VersionsB, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "VersionsB", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/models/_enums.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/models/_enums.py deleted file mode 100644 index df5743f4e0e5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/models/_enums.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class VersionsB(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of VersionsB.""" - - BV1 = "bv1" - """BV1.""" - BV2 = "bv2" - """BV2.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/models/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/operations/__init__.py deleted file mode 100644 index 91e9291df9ea..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import Operations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/operations/_operations.py deleted file mode 100644 index 00dbd650e682..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/operations/_operations.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from ...servicea._utils.serialization import Deserializer, Serializer -from .._configuration import ServiceBClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_operations_op_b_request(**kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "bv2")) - # Construct URL - _url = "/service/multiple-services/service-b/b-test" - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~service.multipleservices.servicea.ServiceBClient`'s - :attr:`operations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ServiceBClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def op_b(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """op_b. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_operations_op_b_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/operations/__init__.py deleted file mode 100644 index 7600403fdead..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import SubNamespaceOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SubNamespaceOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/operations/_operations.py deleted file mode 100644 index 3f865aab8bfe..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/operations/_operations.py +++ /dev/null @@ -1,92 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async - -from .....servicea._utils.serialization import Deserializer, Serializer -from ....aio._configuration import ServiceBClientConfiguration -from ...operations._operations import build_sub_namespace_sub_op_b_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class SubNamespaceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~service.multipleservices.servicea.aio.ServiceBClient`'s - :attr:`sub_namespace` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ServiceBClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def sub_op_b(self, **kwargs: Any) -> None: - """sub_op_b. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_sub_namespace_sub_op_b_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/aio/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/operations/__init__.py deleted file mode 100644 index 7600403fdead..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import SubNamespaceOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SubNamespaceOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/operations/_operations.py deleted file mode 100644 index 2c2a5acfedf4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/operations/_operations.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from ....servicea._utils.serialization import Deserializer, Serializer -from ..._configuration import ServiceBClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_sub_namespace_sub_op_b_request(**kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "bv2")) - # Construct URL - _url = "/service/multiple-services/service-b/b-sub-test" - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -class SubNamespaceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~service.multipleservices.servicea.ServiceBClient`'s - :attr:`sub_namespace` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ServiceBClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def sub_op_b(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """sub_op_b. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_sub_namespace_sub_op_b_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/service-multiple-services/service/multipleservices/serviceb/subnamespace/operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/types.py deleted file mode 100644 index 7575fd0bb676..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/special-words/specialwords/types.py +++ /dev/null @@ -1,441 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class AndModel(TypedDict, total=False): - """AndModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class AsModel(TypedDict, total=False): - """AsModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class AssertModel(TypedDict, total=False): - """AssertModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class AsyncModel(TypedDict, total=False): - """AsyncModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class AwaitModel(TypedDict, total=False): - """AwaitModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class BreakModel(TypedDict, total=False): - """BreakModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ClassModel(TypedDict, total=False): - """ClassModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Constructor(TypedDict, total=False): - """Constructor. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ContinueModel(TypedDict, total=False): - """ContinueModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class DefModel(TypedDict, total=False): - """DefModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class DelModel(TypedDict, total=False): - """DelModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class DictMethods(TypedDict, total=False): - """DictMethods. - - :ivar keys_property: Required. - :vartype keys_property: str - :ivar items_property: Required. - :vartype items_property: str - :ivar values_property: Required. - :vartype values_property: str - :ivar popitem_property: Required. - :vartype popitem_property: str - :ivar clear_property: Required. - :vartype clear_property: str - :ivar update_property: Required. - :vartype update_property: str - :ivar setdefault_property: Required. - :vartype setdefault_property: str - :ivar pop_property: Required. - :vartype pop_property: str - :ivar get_property: Required. - :vartype get_property: str - :ivar copy_property: Required. - :vartype copy_property: str - """ - - keys: Required[str] - """Required.""" - items: Required[str] - """Required.""" - values: Required[str] - """Required.""" - popitem: Required[str] - """Required.""" - clear: Required[str] - """Required.""" - update: Required[str] - """Required.""" - setdefault: Required[str] - """Required.""" - pop: Required[str] - """Required.""" - get: Required[str] - """Required.""" - copy: Required[str] - """Required.""" - - -class ElifModel(TypedDict, total=False): - """ElifModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ElseModel(TypedDict, total=False): - """ElseModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ExceptModel(TypedDict, total=False): - """ExceptModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ExecModel(TypedDict, total=False): - """ExecModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class FinallyModel(TypedDict, total=False): - """FinallyModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ForModel(TypedDict, total=False): - """ForModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class FromModel(TypedDict, total=False): - """FromModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class GlobalModel(TypedDict, total=False): - """GlobalModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class IfModel(TypedDict, total=False): - """IfModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ImportModel(TypedDict, total=False): - """ImportModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class InModel(TypedDict, total=False): - """InModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class IsModel(TypedDict, total=False): - """IsModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class LambdaModel(TypedDict, total=False): - """LambdaModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ModelWithList(TypedDict, total=False): - """ModelWithList. - - :ivar list: Required. - :vartype list: str - """ - - list: Required[str] - """Required.""" - - -class NotModel(TypedDict, total=False): - """NotModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class OrModel(TypedDict, total=False): - """OrModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class PassModel(TypedDict, total=False): - """PassModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class RaiseModel(TypedDict, total=False): - """RaiseModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ReturnModel(TypedDict, total=False): - """ReturnModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class SameAsModel(TypedDict, total=False): - """SameAsModel. - - :ivar same_as_model: Required. - :vartype same_as_model: str - """ - - SameAsModel: Required[str] - """Required.""" - - -class TryModel(TypedDict, total=False): - """TryModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class WhileModel(TypedDict, total=False): - """WhileModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class WithModel(TypedDict, total=False): - """WithModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class YieldModel(TypedDict, total=False): - """YieldModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/types.py deleted file mode 100644 index 8c166362b772..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/specs-documentation/specs/documentation/types.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import BulletPointsEnum - - -class BulletPointsModel(TypedDict, total=False): - """This tests: - - * Simple bullet point. This bullet point is going to be very long to test how text wrapping is - handled in bullet points within documentation comments. It should properly indent the wrapped - lines. - * Another bullet point with **bold text**. This bullet point is also intentionally long to see - how the formatting is preserved when the text wraps onto multiple lines in the generated - documentation. - * Third bullet point with *italic text*. Similar to the previous points, this one is extended - to ensure that the wrapping and formatting are correctly applied in the output. - * Complex bullet point with **bold** and *italic* combined. This bullet point combines both - bold and italic formatting and is long enough to test the wrapping behavior in such cases. - * **Bold bullet point**: A bullet point that is entirely bolded. This point is also made - lengthy to observe how the bold formatting is maintained across wrapped lines. - * *Italic bullet point*: A bullet point that is entirely italicized. This final point is - extended to verify that italic formatting is correctly applied even when the text spans - multiple lines. - - :ivar prop: This property uses an enum with bullet point documentation. The enum documentation - includes various formatting styles to test rendering. The styles are: - - * Simple bullet point. This bullet point is going to be very long to test how text - wrapping is handled in bullet points within documentation comments. It should properly indent - the wrapped lines. - * Bullet point with **bold text**. This bullet point is also intentionally long to see how - the formatting is preserved when the text wraps onto multiple - * Bullet point with *italic text*. Similar to the previous points, this one is extended to - ensure that the wrapping and formatting are correctly applied in the output. - * Complex bullet point with **bold** and *italic* combined. This bullet point combines - both bold and italic formatting and is long enough to test the wrapping behavior in such cases. - * **Bold bullet point** - * *Italic bullet point*. Required. Known values are: "Simple", "Bold", and "Italic". - :vartype prop: str or ~specs.documentation.models.BulletPointsEnum - """ - - prop: Required[Union[str, "BulletPointsEnum"]] - """This property uses an enum with bullet point documentation. The enum documentation includes - various formatting styles to test rendering. The styles are: - - * Simple bullet point. This bullet point is going to be very long to test how text - wrapping is handled in bullet points within documentation comments. It should properly indent - the wrapped lines. - * Bullet point with **bold text**. This bullet point is also intentionally long to see how - the formatting is preserved when the text wraps onto multiple - * Bullet point with *italic text*. Similar to the previous points, this one is extended to - ensure that the wrapping and formatting are correctly applied in the output. - * Complex bullet point with **bold** and *italic* combined. This bullet point combines - both bold and italic formatting and is long enough to test the wrapping behavior in such cases. - * **Bold bullet point** - * *Italic bullet point*. Required. Known values are: \"Simple\", \"Bold\", and \"Italic\".""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/types.py deleted file mode 100644 index c9304917a17c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/types.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Info(TypedDict, total=False): - """Info. - - :ivar desc: Required. - :vartype desc: str - """ - - desc: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/types.py deleted file mode 100644 index fe2094055f08..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-array/typetest/array/types.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class InnerModel(TypedDict, total=False): - """Array inner model. - - :ivar property: Required string property. Required. - :vartype property: str - :ivar children: - :vartype children: list[~typetest.array.models.InnerModel] - """ - - property: Required[str] - """Required string property. Required.""" - children: list["InnerModel"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/types.py deleted file mode 100644 index 58e1c2ce9402..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-dictionary/typetest/dictionary/types.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class InnerModel(TypedDict, total=False): - """Dictionary inner model. - - :ivar property: Required string property. Required. - :vartype property: str - :ivar children: - :vartype children: dict[str, ~typetest.dictionary.models.InnerModel] - """ - - property: Required[str] - """Required string property. Required.""" - children: dict[str, "InnerModel"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_unions.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_unions.py deleted file mode 100644 index 5fd92d86ad7e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_unions.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union - -if TYPE_CHECKING: - from . import models as _models -PetWithEnvelope = Union["_models.Cat", "_models.Dog"] -PetWithCustomNames = Union["_models.Cat", "_models.Dog"] -PetInline = Union["_models.Cat", "_models.Dog"] -PetInlineWithCustomDiscriminator = Union["_models.Cat", "_models.Dog"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/types.py deleted file mode 100644 index 0ab282f27792..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/types.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Cat(TypedDict, total=False): - """Cat. - - :ivar name: Required. - :vartype name: str - :ivar meow: Required. - :vartype meow: bool - """ - - name: Required[str] - """Required.""" - meow: Required[bool] - """Required.""" - - -class Dog(TypedDict, total=False): - """Dog. - - :ivar name: Required. - :vartype name: str - :ivar bark: Required. - :vartype bark: bool - """ - - name: Required[str] - """Required.""" - bark: Required[bool] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/types.py deleted file mode 100644 index 1ecc1c8a331c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-empty/typetest/model/empty/types.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import TypedDict - - -class EmptyInput(TypedDict, total=False): - """Empty model used in operation parameters.""" - - -class EmptyInputOutput(TypedDict, total=False): - """Empty model used in both parameter and return type.""" - - -class EmptyOutput(TypedDict, total=False): - """Empty model used in operation return type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/types.py deleted file mode 100644 index d150e7f4ab6d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/types.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - -from .models._enums import DogKind, SnakeKind - - -class Cobra(TypedDict, total=False): - """Cobra model. - - :ivar length: Length of the snake. Required. - :vartype length: int - :ivar kind: discriminator property. Required. Species cobra. - :vartype kind: str or ~typetest.model.enumdiscriminator.models.COBRA - """ - - length: Required[int] - """Length of the snake. Required.""" - kind: Required[Literal[SnakeKind.COBRA]] - """discriminator property. Required. Species cobra.""" - - -class Golden(TypedDict, total=False): - """Golden dog model. - - :ivar weight: Weight of the dog. Required. - :vartype weight: int - :ivar kind: discriminator property. Required. Species golden. - :vartype kind: str or ~typetest.model.enumdiscriminator.models.GOLDEN - """ - - weight: Required[int] - """Weight of the dog. Required.""" - kind: Required[Literal[DogKind.GOLDEN]] - """discriminator property. Required. Species golden.""" - - -Snake = Union[Cobra] -Dog = Union[Golden] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/types.py deleted file mode 100644 index b401a3903a6b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/types.py +++ /dev/null @@ -1,77 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class GoblinShark(TypedDict, total=False): - """The third level model GoblinShark in polymorphic multiple levels inheritance. - - :ivar age: Required. - :vartype age: int - :ivar kind: Required. Default value is "shark". - :vartype kind: str - :ivar sharktype: Required. Default value is "goblin". - :vartype sharktype: str - """ - - age: Required[int] - """Required.""" - kind: Required[Literal["shark"]] - """Required. Default value is \"shark\".""" - sharktype: Required[Literal["goblin"]] - """Required. Default value is \"goblin\".""" - - -class Salmon(TypedDict, total=False): - """The second level model in polymorphic multiple levels inheritance which contains references to - other polymorphic instances. - - :ivar age: Required. - :vartype age: int - :ivar kind: Required. Default value is "salmon". - :vartype kind: str - :ivar friends: - :vartype friends: list[~typetest.model.nesteddiscriminator.models.Fish] - :ivar hate: - :vartype hate: dict[str, ~typetest.model.nesteddiscriminator.models.Fish] - :ivar partner: - :vartype partner: ~typetest.model.nesteddiscriminator.models.Fish - """ - - age: Required[int] - """Required.""" - kind: Required[Literal["salmon"]] - """Required. Default value is \"salmon\".""" - friends: list["Fish"] - hate: dict[str, "Fish"] - partner: "Fish" - - -class SawShark(TypedDict, total=False): - """The third level model SawShark in polymorphic multiple levels inheritance. - - :ivar age: Required. - :vartype age: int - :ivar kind: Required. Default value is "shark". - :vartype kind: str - :ivar sharktype: Required. Default value is "saw". - :vartype sharktype: str - """ - - age: Required[int] - """Required.""" - kind: Required[Literal["shark"]] - """Required. Default value is \"shark\".""" - sharktype: Required[Literal["saw"]] - """Required. Default value is \"saw\".""" - - -Shark = Union[GoblinShark, SawShark] -Fish = Union[Salmon, Shark] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/CHANGELOG.md deleted file mode 100644 index b957b2575b48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release History - -## 1.0.0b1 (1970-01-01) - -### Other Changes - - - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/LICENSE b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/LICENSE deleted file mode 100644 index 63447fd8bbbf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/MANIFEST.in b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/MANIFEST.in deleted file mode 100644 index 1f779fa3398b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include *.md -include LICENSE -include typetest/model/notdiscriminated/typeddict/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include typetest/__init__.py -include typetest/model/__init__.py -include typetest/model/notdiscriminated/__init__.py diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/_metadata.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/_metadata.json deleted file mode 100644 index 49515fdbafdf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/_metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "apiVersions": {} -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/apiview-properties.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/apiview-properties.json deleted file mode 100644 index dcc32a287848..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/apiview-properties.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Inheritance.NotDiscriminated", - "CrossLanguageDefinitionId": { - "typetest.model.notdiscriminated.typeddict.models.Pet": "Type.Model.Inheritance.NotDiscriminated.Pet", - "typetest.model.notdiscriminated.typeddict.models.Cat": "Type.Model.Inheritance.NotDiscriminated.Cat", - "typetest.model.notdiscriminated.typeddict.models.Siamese": "Type.Model.Inheritance.NotDiscriminated.Siamese", - "typetest.model.notdiscriminated.typeddict.NotDiscriminatedClient.post_valid": "Type.Model.Inheritance.NotDiscriminated.postValid", - "typetest.model.notdiscriminated.typeddict.aio.NotDiscriminatedClient.post_valid": "Type.Model.Inheritance.NotDiscriminated.postValid", - "typetest.model.notdiscriminated.typeddict.NotDiscriminatedClient.get_valid": "Type.Model.Inheritance.NotDiscriminated.getValid", - "typetest.model.notdiscriminated.typeddict.aio.NotDiscriminatedClient.get_valid": "Type.Model.Inheritance.NotDiscriminated.getValid", - "typetest.model.notdiscriminated.typeddict.NotDiscriminatedClient.put_valid": "Type.Model.Inheritance.NotDiscriminated.putValid", - "typetest.model.notdiscriminated.typeddict.aio.NotDiscriminatedClient.put_valid": "Type.Model.Inheritance.NotDiscriminated.putValid" - }, - "CrossLanguageVersion": "94c71641655e" -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/dev_requirements.txt b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/dev_requirements.txt deleted file mode 100644 index 0e53b6a72db5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/dev_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --e ../../../eng/tools/azure-sdk-tools -../../core/azure-core -aiohttp \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/conftest.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/conftest.py deleted file mode 100644 index f6b002192937..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/conftest.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import os -import pytest -from dotenv import load_dotenv -from devtools_testutils import ( - test_proxy, - add_general_regex_sanitizer, - add_body_key_sanitizer, - add_header_regex_sanitizer, -) - -load_dotenv() - - -# For security, please avoid record sensitive identity information in recordings -@pytest.fixture(scope="session", autouse=True) -def add_sanitizers(test_proxy): - notdiscriminated_subscription_id = os.environ.get( - "NOTDISCRIMINATED_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" - ) - notdiscriminated_tenant_id = os.environ.get("NOTDISCRIMINATED_TENANT_ID", "00000000-0000-0000-0000-000000000000") - notdiscriminated_client_id = os.environ.get("NOTDISCRIMINATED_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - notdiscriminated_client_secret = os.environ.get( - "NOTDISCRIMINATED_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" - ) - add_general_regex_sanitizer(regex=notdiscriminated_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=notdiscriminated_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=notdiscriminated_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=notdiscriminated_client_secret, value="00000000-0000-0000-0000-000000000000") - - add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") - add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/test_not_discriminated.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/test_not_discriminated.py deleted file mode 100644 index 8cae28e36be4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/test_not_discriminated.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import NotDiscriminatedClientTestBase, NotDiscriminatedPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNotDiscriminated(NotDiscriminatedClientTestBase): - @NotDiscriminatedPreparer() - @recorded_by_proxy - def test_post_valid(self, notdiscriminated_endpoint): - client = self.create_client(endpoint=notdiscriminated_endpoint) - response = client.post_valid( - input={"age": 0, "name": "str", "smart": bool}, - ) - - # please add some check logic here by yourself - # ... - - @NotDiscriminatedPreparer() - @recorded_by_proxy - def test_get_valid(self, notdiscriminated_endpoint): - client = self.create_client(endpoint=notdiscriminated_endpoint) - response = client.get_valid() - - # please add some check logic here by yourself - # ... - - @NotDiscriminatedPreparer() - @recorded_by_proxy - def test_put_valid(self, notdiscriminated_endpoint): - client = self.create_client(endpoint=notdiscriminated_endpoint) - response = client.put_valid( - input={"age": 0, "name": "str", "smart": bool}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/test_not_discriminated_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/test_not_discriminated_async.py deleted file mode 100644 index a9df6bb895b3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/test_not_discriminated_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import NotDiscriminatedPreparer -from testpreparer_async import NotDiscriminatedClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestNotDiscriminatedAsync(NotDiscriminatedClientTestBaseAsync): - @NotDiscriminatedPreparer() - @recorded_by_proxy_async - async def test_post_valid(self, notdiscriminated_endpoint): - client = self.create_async_client(endpoint=notdiscriminated_endpoint) - response = await client.post_valid( - input={"age": 0, "name": "str", "smart": bool}, - ) - - # please add some check logic here by yourself - # ... - - @NotDiscriminatedPreparer() - @recorded_by_proxy_async - async def test_get_valid(self, notdiscriminated_endpoint): - client = self.create_async_client(endpoint=notdiscriminated_endpoint) - response = await client.get_valid() - - # please add some check logic here by yourself - # ... - - @NotDiscriminatedPreparer() - @recorded_by_proxy_async - async def test_put_valid(self, notdiscriminated_endpoint): - client = self.create_async_client(endpoint=notdiscriminated_endpoint) - response = await client.put_valid( - input={"age": 0, "name": "str", "smart": bool}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/testpreparer.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/testpreparer.py deleted file mode 100644 index a92a2848b06f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/testpreparer.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer -import functools -from typetest.model.notdiscriminated.typeddict import NotDiscriminatedClient - - -class NotDiscriminatedClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(NotDiscriminatedClient) - return self.create_client_from_credential( - NotDiscriminatedClient, - credential=credential, - endpoint=endpoint, - ) - - -NotDiscriminatedPreparer = functools.partial( - PowerShellPreparer, "notdiscriminated", notdiscriminated_endpoint="https://fake_notdiscriminated_endpoint.com" -) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/testpreparer_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/testpreparer_async.py deleted file mode 100644 index fb5df7e5ed11..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/generated_tests/testpreparer_async.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase -from typetest.model.notdiscriminated.typeddict.aio import NotDiscriminatedClient - - -class NotDiscriminatedClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(NotDiscriminatedClient, is_async=True) - return self.create_client_from_credential( - NotDiscriminatedClient, - credential=credential, - endpoint=endpoint, - ) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/pyproject.toml b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/pyproject.toml deleted file mode 100644 index f5f1a1907ac3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/pyproject.toml +++ /dev/null @@ -1,61 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -[build-system] -requires = ["setuptools>=77.0.3", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "typetest-model-notdiscriminated-typeddict" -authors = [ - { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, -] -description = "Microsoft Corporation Azure Typetest Model Notdiscriminated Typeddict Client Library for Python" -license = "MIT" -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", -] -requires-python = ">=3.10" -keywords = ["azure", "azure sdk"] - -dependencies = [ - "isodate>=0.6.1", - "azure-core>=1.37.0", - "typing-extensions>=4.6.0", -] -dynamic = [ -"version", "readme" -] - -[project.urls] -repository = "https://github.com/Azure/azure-sdk-for-python" - -[tool.setuptools.dynamic] -version = {attr = "typetest.model.notdiscriminated.typeddict._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} - -[tool.setuptools.packages.find] -exclude = [ - "tests*", - "generated_tests*", - "samples*", - "generated_samples*", - "doc*", - "typetest", - "typetest.model", - "typetest.model.notdiscriminated", -] - -[tool.setuptools.package-data] -pytyped = ["py.typed"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/__init__.py deleted file mode 100644 index e8b250268143..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import NotDiscriminatedClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "NotDiscriminatedClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_client.py deleted file mode 100644 index d7ef2a7b2fae..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_client.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -import sys -from typing import Any - -from azure.core import PipelineClient -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse - -from ._configuration import NotDiscriminatedClientConfiguration -from ._operations import _NotDiscriminatedClientOperationsMixin -from ._utils.serialization import Deserializer, Serializer - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class NotDiscriminatedClient( - _NotDiscriminatedClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """Illustrates not-discriminated inheritance model. - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = NotDiscriminatedClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_configuration.py deleted file mode 100644 index e26515d75a5f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from ._version import VERSION - - -class NotDiscriminatedClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for NotDiscriminatedClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-notdiscriminated-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/__init__.py deleted file mode 100644 index 55cfeb709325..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _NotDiscriminatedClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_operations.py deleted file mode 100644 index db8b9e39d6d6..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_operations.py +++ /dev/null @@ -1,363 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models, types -from .._configuration import NotDiscriminatedClientConfiguration -from .._utils.model_base import SdkJSONEncoder, _deserialize -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_not_discriminated_post_valid_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/type/model/inheritance/not-discriminated/valid" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_not_discriminated_get_valid_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/not-discriminated/valid" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_not_discriminated_put_valid_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/not-discriminated/valid" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -class _NotDiscriminatedClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], NotDiscriminatedClientConfiguration] -): - - @overload - def post_valid(self, input: _models.Siamese, *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def post_valid(self, input: types.Siamese, *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.types.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def post_valid(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def post_valid( # pylint: disable=inconsistent-return-statements - self, input: Union[_models.Siamese, types.Siamese, IO[bytes]], **kwargs: Any - ) -> None: - """post_valid. - - :param input: Is either a Siamese type or a IO[bytes] type. Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese or - ~typetest.model.notdiscriminated.typeddict.types.Siamese or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_not_discriminated_post_valid_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_valid(self, **kwargs: Any) -> _models.Siamese: - """get_valid. - - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Siamese] = kwargs.pop("cls", None) - - _request = build_not_discriminated_get_valid_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Siamese, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put_valid( - self, input: _models.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_valid( - self, input: types.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.types.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_valid(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_valid(self, input: Union[_models.Siamese, types.Siamese, IO[bytes]], **kwargs: Any) -> _models.Siamese: - """put_valid. - - :param input: Is either a Siamese type or a IO[bytes] type. Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese or - ~typetest.model.notdiscriminated.typeddict.types.Siamese or IO[bytes] - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Siamese] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_not_discriminated_put_valid_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Siamese, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/__init__.py deleted file mode 100644 index 8026245c2abc..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/model_base.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/model_base.py deleted file mode 100644 index d725c55906d3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/model_base.py +++ /dev/null @@ -1,1737 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=protected-access, broad-except - -import copy -import calendar -import decimal -import functools -import sys -import logging -import base64 -import re -import typing -import enum -import email.utils -from datetime import datetime, date, time, timedelta, timezone -from json import JSONEncoder -import xml.etree.ElementTree as ET -from collections.abc import MutableMapping -import isodate -from azure.core.exceptions import DeserializationError -from azure.core import CaseInsensitiveEnumMeta -from azure.core.pipeline import PipelineResponse -from azure.core.serialization import _Null - -from azure.core.rest import HttpResponse - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_LOGGER = logging.getLogger(__name__) - -__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] - -TZ_UTC = timezone.utc -_T = typing.TypeVar("_T") -_NONE_TYPE = type(None) - - -def _timedelta_as_isostr(td: timedelta) -> str: - """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' - - Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython - - :param timedelta td: The timedelta to convert - :rtype: str - :return: ISO8601 version of this timedelta - """ - - # Split seconds to larger units - seconds = td.total_seconds() - minutes, seconds = divmod(seconds, 60) - hours, minutes = divmod(minutes, 60) - days, hours = divmod(hours, 24) - - days, hours, minutes = list(map(int, (days, hours, minutes))) - seconds = round(seconds, 6) - - # Build date - date_str = "" - if days: - date_str = "%sD" % days - - if hours or minutes or seconds: - # Build time - time_str = "T" - - # Hours - bigger_exists = date_str or hours - if bigger_exists: - time_str += "{:02}H".format(hours) - - # Minutes - bigger_exists = bigger_exists or minutes - if bigger_exists: - time_str += "{:02}M".format(minutes) - - # Seconds - try: - if seconds.is_integer(): - seconds_string = "{:02}".format(int(seconds)) - else: - # 9 chars long w/ leading 0, 6 digits after decimal - seconds_string = "%09.6f" % seconds - # Remove trailing zeros - seconds_string = seconds_string.rstrip("0") - except AttributeError: # int.is_integer() raises - seconds_string = "{:02}".format(seconds) - - time_str += "{}S".format(seconds_string) - else: - time_str = "" - - return "P" + date_str + time_str - - -def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: - encoded = base64.b64encode(o).decode() - if format == "base64url": - return encoded.strip("=").replace("+", "-").replace("/", "_") - return encoded - - -def _serialize_datetime(o, format: typing.Optional[str] = None): - if hasattr(o, "year") and hasattr(o, "hour"): - if format == "rfc7231": - return email.utils.format_datetime(o, usegmt=True) - if format == "unix-timestamp": - return int(calendar.timegm(o.utctimetuple())) - - # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) - if not o.tzinfo: - iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() - else: - iso_formatted = o.astimezone(TZ_UTC).isoformat() - # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) - return iso_formatted.replace("+00:00", "Z") - # Next try datetime.date or datetime.time - return o.isoformat() - - -def _is_readonly(p): - try: - return p._visibility == ["read"] - except AttributeError: - return False - - -class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" - - def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): - super().__init__(*args, **kwargs) - self.exclude_readonly = exclude_readonly - self.format = format - - def default(self, o): # pylint: disable=too-many-return-statements - if _is_model(o): - if self.exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - return {k: v for k, v in o.items() if k not in readonly_props} - return dict(o.items()) - try: - return super(SdkJSONEncoder, self).default(o) - except TypeError: - if isinstance(o, _Null): - return None - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, self.format) - try: - # First try datetime.datetime - return _serialize_datetime(o, self.format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return super(SdkJSONEncoder, self).default(o) - - -_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") -_VALID_RFC7231 = re.compile( - r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" - r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" -) - -_ARRAY_ENCODE_MAPPING = { - "pipeDelimited": "|", - "spaceDelimited": " ", - "commaDelimited": ",", - "newlineDelimited": "\n", -} - - -def _deserialize_array_encoded(delimit: str, attr): - if isinstance(attr, str): - if attr == "": - return [] - return attr.split(delimit) - return attr - - -def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - attr = attr.upper() - match = _VALID_DATE.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - return date_obj # type: ignore[no-any-return] - - -def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize RFC7231 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - match = _VALID_RFC7231.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - return email.utils.parsedate_to_datetime(attr) - - -def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: - """Deserialize unix timestamp into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - return datetime.fromtimestamp(attr, TZ_UTC) - - -def _deserialize_date(attr: typing.Union[str, date]) -> date: - """Deserialize ISO-8601 formatted string into Date object. - :param str attr: response string to be deserialized. - :rtype: date - :returns: The date object from that input - """ - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - if isinstance(attr, date): - return attr - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore - - -def _deserialize_time(attr: typing.Union[str, time]) -> time: - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :returns: The time object from that input - """ - if isinstance(attr, time): - return attr - return isodate.parse_time(attr) # type: ignore[no-any-return] - - -def _deserialize_bytes(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - return bytes(base64.b64decode(attr)) - - -def _deserialize_bytes_base64(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return bytes(base64.b64decode(encoded)) - - -def _deserialize_duration(attr): - if isinstance(attr, timedelta): - return attr - return isodate.parse_duration(attr) - - -def _deserialize_decimal(attr): - if isinstance(attr, decimal.Decimal): - return attr - return decimal.Decimal(str(attr)) - - -def _deserialize_int_as_str(attr): - if isinstance(attr, int): - return attr - return int(attr) - - -_DESERIALIZE_MAPPING = { - datetime: _deserialize_datetime, - date: _deserialize_date, - time: _deserialize_time, - bytes: _deserialize_bytes, - bytearray: _deserialize_bytes, - timedelta: _deserialize_duration, - typing.Any: lambda x: x, - decimal.Decimal: _deserialize_decimal, -} - -_DESERIALIZE_MAPPING_WITHFORMAT = { - "rfc3339": _deserialize_datetime, - "rfc7231": _deserialize_datetime_rfc7231, - "unix-timestamp": _deserialize_datetime_unix_timestamp, - "base64": _deserialize_bytes, - "base64url": _deserialize_bytes_base64, -} - - -def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): - if annotation is int and rf and rf._format == "str": - return _deserialize_int_as_str - if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: - return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) - if rf and rf._format: - return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) - return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore - - -def _get_type_alias_type(module_name: str, alias_name: str): - types = { - k: v - for k, v in sys.modules[module_name].__dict__.items() - if isinstance(v, typing._GenericAlias) # type: ignore - } - if alias_name not in types: - return alias_name - return types[alias_name] - - -def _get_model(module_name: str, model_name: str): - models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} - module_end = module_name.rsplit(".", 1)[0] - models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) - if isinstance(model_name, str): - model_name = model_name.split(".")[-1] - if model_name not in models: - return model_name - return models[model_name] - - -_UNSET = object() - - -class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: dict[str, typing.Any]) -> None: - self._data = data - - def __contains__(self, key: typing.Any) -> bool: - return key in self._data - - def __getitem__(self, key: str) -> typing.Any: - # If this key has been deserialized (for mutable types), we need to handle serialization - if hasattr(self, "_attr_to_rest_field"): - cache_attr = f"_deserialized_{key}" - if hasattr(self, cache_attr): - rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) - if rf: - value = self._data.get(key) - if isinstance(value, (dict, list, set)): - # For mutable types, serialize and return - # But also update _data with serialized form and clear flag - # so mutations via this returned value affect _data - serialized = _serialize(value, rf._format) - # If serialized form is same type (no transformation needed), - # return _data directly so mutations work - if isinstance(serialized, type(value)) and serialized == value: - return self._data.get(key) - # Otherwise return serialized copy and clear flag - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - # Store serialized form back - self._data[key] = serialized - return serialized - return self._data.__getitem__(key) - - def __setitem__(self, key: str, value: typing.Any) -> None: - # Clear any cached deserialized value when setting through dictionary access - cache_attr = f"_deserialized_{key}" - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - self._data.__setitem__(key, value) - - def __delitem__(self, key: str) -> None: - self._data.__delitem__(key) - - def __iter__(self) -> typing.Iterator[typing.Any]: - return self._data.__iter__() - - def __len__(self) -> int: - return self._data.__len__() - - def __ne__(self, other: typing.Any) -> bool: - return not self.__eq__(other) - - def keys(self) -> typing.KeysView[str]: - """ - :returns: a set-like object providing a view on D's keys - :rtype: ~typing.KeysView - """ - return self._data.keys() - - def values(self) -> typing.ValuesView[typing.Any]: - """ - :returns: an object providing a view on D's values - :rtype: ~typing.ValuesView - """ - return self._data.values() - - def items(self) -> typing.ItemsView[str, typing.Any]: - """ - :returns: set-like object providing a view on D's items - :rtype: ~typing.ItemsView - """ - return self._data.items() - - def get(self, key: str, default: typing.Any = None) -> typing.Any: - """ - Get the value for key if key is in the dictionary, else default. - :param str key: The key to look up. - :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. - :rtype: any - """ - try: - return self[key] - except KeyError: - return default - - @typing.overload - def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ - - @typing.overload - def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs - - @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Removes specified key and return the corresponding value. - :param str key: The key to pop. - :param any default: The value to return if key is not in the dictionary - :returns: The value corresponding to the key. - :rtype: any - :raises KeyError: If key is not found and default is not given. - """ - if default is _UNSET: - return self._data.pop(key) - return self._data.pop(key, default) - - def popitem(self) -> tuple[str, typing.Any]: - """ - Removes and returns some (key, value) pair - :returns: The (key, value) pair. - :rtype: tuple - :raises KeyError: if D is empty. - """ - return self._data.popitem() - - def clear(self) -> None: - """ - Remove all items from D. - """ - self._data.clear() - - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ - """ - Updates D from mapping/iterable E and F. - :param any args: Either a mapping object or an iterable of key-value pairs. - """ - self._data.update(*args, **kwargs) - - @typing.overload - def setdefault(self, key: str, default: None = None) -> None: ... - - @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Same as calling D.get(k, d), and setting D[k]=d if k not found - :param str key: The key to look up. - :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. - :rtype: any - """ - if default is _UNSET: - return self._data.setdefault(key) - return self._data.setdefault(key, default) - - def __eq__(self, other: typing.Any) -> bool: - if isinstance(other, _MyMutableMapping): - return self._data == other._data - try: - other_model = self.__class__(other) - except Exception: - return False - return self._data == other_model._data - - def __repr__(self) -> str: - return str(self._data) - - -def _is_model(obj: typing.Any) -> bool: - return getattr(obj, "_is_model", False) - - -def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements - if isinstance(o, list): - if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): - return _ARRAY_ENCODE_MAPPING[format].join(o) - return [_serialize(x, format) for x in o] - if isinstance(o, dict): - return {k: _serialize(v, format) for k, v in o.items()} - if isinstance(o, set): - return {_serialize(x, format) for x in o} - if isinstance(o, tuple): - return tuple(_serialize(x, format) for x in o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, format) - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, enum.Enum): - return o.value - if isinstance(o, int): - if format == "str": - return str(o) - return o - try: - # First try datetime.datetime - return _serialize_datetime(o, format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return o - - -def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: - try: - return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) - except StopIteration: - return None - - -def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: - if not rf: - return _serialize(value, None) - if rf._is_multipart_file_input: - return value - if rf._is_model: - return _deserialize(rf._type, value) - if isinstance(value, ET.Element): - value = _deserialize(rf._type, value) - return _serialize(value, rf._format) - - -# ============================================================================ -# Fast-path scalar deserializer functions for rest_field(deserializer=...) -# These are referenced from rest_field declarations to bypass the generic -# _deserialize -> _deserialize_with_callable chain. -# Only simple/primitive types — no models or container types. -# ============================================================================ - - -def _xml_deser_str(value): - if isinstance(value, ET.Element): - return value.text or "" - return str(value) if value is not None else None - - -def _xml_deser_int(value): - if isinstance(value, ET.Element): - return int(value.text) if value.text else None - return int(value) if value is not None else None - - -def _xml_deser_float(value): - if isinstance(value, ET.Element): - return float(value.text) if value.text else None - return float(value) if value is not None else None - - -def _xml_deser_bool(value): - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - if text in (True, False): - return text - return text.lower() == "true" - - -# pylint: disable=docstring-missing-param -def _xml_deser_bytes(value): - """Deserialize bytes from XML (base64).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes(text) - - -def _xml_deser_bytes_base64url(value): - """Deserialize bytes from XML (base64url).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes_base64(text) - - -def _xml_deser_datetime(value): - """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime(text) - - -def _xml_deser_datetime_rfc7231(value): - """Deserialize a datetime from XML (RFC7231 format).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_rfc7231(text) - - -def _xml_deser_datetime_unix_timestamp(value): - """Deserialize a datetime from XML (Unix timestamp).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_unix_timestamp(float(text)) - - -def _xml_deser_date(value): - """Deserialize a date from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_date(text) - - -def _xml_deser_time(value): - """Deserialize a time from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_time(text) - - -def _xml_deser_duration(value): - """Deserialize a timedelta from XML (ISO 8601 duration).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_duration(text) - - -def _xml_deser_decimal(value): - """Deserialize a Decimal from XML.""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_decimal(text) - - -def _xml_deser_enum_or_str(enum_cls, value): - """Deserialize a Union[EnumType, str] from XML.""" - text = value.text if isinstance(value, ET.Element) else value - if text is None: - return None - try: - return enum_cls(text) - except ValueError: - return text - - -def _extract_xml_model_type(rf_type): - """Extract the concrete Model class from a resolved rf._type partial chain. - - Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` - wrappers. Only handles Model and Optional[Model] — other composite - types (List, Dict, Union, etc.) return None and fall through to the - generic ``_deserialize`` path at runtime. - """ - if rf_type is None: - return None - if isinstance(rf_type, type) and _is_model(rf_type): - return rf_type - if not isinstance(rf_type, functools.partial): - return None - func = rf_type.func - args = rf_type.args - if func is _deserialize_with_optional and args: - return _extract_xml_model_type(args[0]) - if func is _deserialize_model and args: - cls = args[0] - return cls if isinstance(cls, type) and _is_model(cls) else None - return None - - -def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable - cls, attr_to_rest_field: dict -) -> list: - """Build a precomputed XML field plan for fast _init_from_xml iteration. - - Called once per model class in __new__. Returns a list of tuples: - (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) - - kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text - - For Model and Optional[Model] fields that lack a scalar - ``_deserializer``, this function precomputes the Model class as the - deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` - directly instead of going through the expensive - ``_get_deserialize_callable_from_annotation`` chain at runtime. - """ - model_meta = getattr(cls, "_xml", {}) - model_ns = model_meta.get("ns") or model_meta.get("namespace") - plan = [] - - for rf in attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - deser = rf._deserializer - - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - is_optional = rf._is_optional - - # For Model / Optional[Model] fields without a scalar deserializer, - # precompute the Model class as the deserializer. - if deser is None and rf._type is not None: - model_cls = _extract_xml_model_type(rf._type) - if model_cls is not None: - deser = model_cls - - if prop_meta.get("attribute", False): - plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) - elif prop_meta.get("unwrapped", False): - items_name = prop_meta.get("itemsName") - if items_name: - items_ns = prop_meta.get("itemsNs") - if items_ns is not None: - xml_ns = items_ns - if xml_ns: - items_name = "{" + xml_ns + "}" + items_name - else: - items_name = xml_name - plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) - elif prop_meta.get("text", False): - plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) - else: - plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) - - return plan - - -# pylint: enable=docstring-missing-param -class Model(_MyMutableMapping): - _is_model = True - # label whether current class's _attr_to_rest_field has been calculated - # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: set[str] = set() - - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: - class_name = self.__class__.__name__ - if len(args) > 1: - raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass: dict[str, typing.Any] = {} - if args: - if isinstance(args[0], ET.Element): - dict_to_pass.update(self._init_from_xml(args[0])) - else: - dict_to_pass.update( - {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} - ) - else: - non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] - if non_attr_kwargs: - # actual type errors only throw the first wrong keyword arg they see, so following that. - raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") - dict_to_pass.update( - { - self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) - for k, v in kwargs.items() - if v is not None - } - ) - # Apply client default values for fields the caller didn't set so that - # defaults are part of `_data` and therefore included during serialization. - for rf in self._attr_to_rest_field.values(): - if rf._default is _UNSET: - continue - if rf._rest_name in dict_to_pass: - continue - dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) - super().__init__(dict_to_pass) - - def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements - self, element: ET.Element - ) -> dict[str, typing.Any]: - """Deserialize an XML element into a dict mapping rest field names to values. - - :param ET.Element element: The XML element to deserialize from. - :returns: A dictionary of rest_name to deserialized value pairs. - :rtype: dict - """ - result: dict[str, typing.Any] = {} - existed_attr_keys: list[str] = [] - - field_plan = getattr(self, "_xml_field_plan", None) - if field_plan: - for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: - if kind == 0: # wrapped element (most common) - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(item) - else: - result[rest_name] = _deserialize(rf_type, item) - elif kind == 1: # attribute - attr_val = element.get(xml_name) - if attr_val is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(attr_val) - else: - result[rest_name] = attr_val - elif kind == 2: # unwrapped array - items = element.findall(items_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(items_name) - if deser: - result[rest_name] = deser(items) - else: - result[rest_name] = _deserialize(rf_type, items) - elif not is_optional: - existed_attr_keys.append(items_name) - result[rest_name] = [] - elif kind == 3: # text - if element.text is not None: - if deser: - result[rest_name] = deser(element.text) - else: - result[rest_name] = element.text - else: - model_meta = getattr(self, "_xml", {}) - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in element: - if e.tag not in existed_attr_keys: - result[e.tag] = _convert_element(e) - - return result - - def copy(self) -> "Model": - return Model(self.__dict__) - - 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' - mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property - k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") - } - annotations = { - k: v - for mro_class in mros - 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__ - if not rf._type: - rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) - if not rf._rest_name_input: - rf._rest_name_input = attr - cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) - # Build XML field plan for fast _init_from_xml (only for XML models) - if getattr(cls, "_xml", None): - cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) - cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - - return super().__new__(cls) - - def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: - for base in cls.__bases__: - if hasattr(base, "__mapping__"): - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore - - @classmethod - def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: - for v in cls.__dict__.values(): - if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: - return v - return None - - @classmethod - def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): - return cls(data) - discriminator = cls._get_discriminator(exist_discriminators) - if discriminator is None: - return cls(data) - exist_discriminators.append(discriminator._rest_name) - if isinstance(data, ET.Element): - model_meta = getattr(cls, "_xml", {}) - prop_meta = getattr(discriminator, "_xml", {}) - xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - if data.get(xml_name) is not None: - discriminator_value = data.get(xml_name) - else: - 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 - return mapped_cls._deserialize(data, exist_discriminators) - - def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: - """Return a dict that can be turned into json using json.dump. - - :keyword bool exclude_readonly: Whether to remove the readonly properties. - :returns: A dict JSON compatible object - :rtype: dict - """ - - result = {} - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] - for k, v in self.items(): - if exclude_readonly and k in readonly_props: # pyright: ignore - continue - is_multipart_file_input = False - try: - is_multipart_file_input = next( - rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k - )._is_multipart_file_input - except StopIteration: - pass - result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) - return result - - @staticmethod - def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: - if v is None or isinstance(v, _Null): - return None - if isinstance(v, (list, tuple, set)): - return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) - if isinstance(v, dict): - return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} - return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v - - -def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - - -def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - -def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - - -def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj: dict[typing.Any, typing.Any], -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = {child.tag: child for child in obj} - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - - -def _deserialize_multiple_sequence( - entry_deserializers: list[typing.Optional[typing.Callable]], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) - - -def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: - return ( - isinstance(deserializer, functools.partial) - and isinstance(deserializer.args[0], functools.partial) - and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable - ) - - -def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = list(obj) - - # encoded string may be deserialized to sequence - if isinstance(obj, str) and isinstance(deserializer, functools.partial): - # for list[str] - if _is_array_encoded_deserializer(deserializer): - return deserializer(obj) - - # for list[Union[...]] - if isinstance(deserializer.args[0], list): - for sub_deserializer in deserializer.args[0]: - if _is_array_encoded_deserializer(sub_deserializer): - return sub_deserializer(obj) - - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - -def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: - return sorted( - types, - key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), - ) - - -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches - annotation: typing.Any, - module: typing.Optional[str], - rf: typing.Optional["_RestField"] = None, -) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - if not annotation: - return None - - # is it a type alias? - if isinstance(annotation, str): - if module is not None: - annotation = _get_type_alias_type(module, annotation) - - # is it a forward ref / in quotes? - if isinstance(annotation, (str, typing.ForwardRef)): - try: - model_name = annotation.__forward_arg__ # type: ignore - except AttributeError: - model_name = annotation - if module is not None: - annotation = _get_model(module, model_name) # type: ignore - - try: - if module and _is_model(annotation): - if rf: - rf._is_model = True - - return functools.partial(_deserialize_model, annotation) # pyright: ignore - except Exception: - pass - - # is it a literal? - try: - if annotation.__origin__ is typing.Literal: # pyright: ignore - return None - except AttributeError: - pass - - # is it optional? - try: - if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore - if rf: - rf._is_optional = True - if len(annotation.__args__) <= 2: # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) - # the type is Optional[Union[...]], we need to remove the None type from the Union - annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore - return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) - except AttributeError: - pass - - # is it union? - if getattr(annotation, "__origin__", None) is typing.Union: - # initial ordering is we make `string` the last deserialization option, because it is often them most generic - deserializers = [ - _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in _sorted_annotations(annotation.__args__) # pyright: ignore - ] - - return functools.partial(_deserialize_with_union, deserializers) - - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() == "dict": - value_deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[1], module, rf # pyright: ignore - ) - - return functools.partial( - _deserialize_dict, - value_deserializer, - module, - ) - except (AttributeError, IndexError): - pass - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: - if len(annotation.__args__) > 1: # pyright: ignore - entry_deserializers = [ - _get_deserialize_callable_from_annotation(dt, module, rf) - for dt in annotation.__args__ # pyright: ignore - ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) - deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[0], module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_sequence, deserializer, module) - except (TypeError, IndexError, AttributeError, SyntaxError): - pass - - def _deserialize_default( - deserializer, - obj, - ): - if obj is None: - return obj - try: - return _deserialize_with_callable(deserializer, obj) - except Exception: - pass - return obj - - if get_deserializer(annotation, rf): - return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) - - return functools.partial(_deserialize_default, annotation) - - -def _deserialize_with_callable( - deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], - value: typing.Any, -): # pylint: disable=too-many-return-statements - try: - if value is None or isinstance(value, _Null): - return None - if isinstance(value, ET.Element): - if deserializer is str: - return value.text or "" - if deserializer is int: - return int(value.text) if value.text else None - if deserializer is float: - return float(value.text) if value.text else None - if deserializer is bool: - return value.text == "true" if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): - return deserializer(value.text) if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): - return deserializer(value.text) if value.text else None - if deserializer is None: - return value - if deserializer in [int, float, bool]: - return deserializer(value) - if isinstance(deserializer, CaseInsensitiveEnumMeta): - try: - return deserializer(value.text if isinstance(value, ET.Element) else value) - except ValueError: - # for unknown value, return raw value - return value.text if isinstance(value, ET.Element) else value - if isinstance(deserializer, type) and issubclass(deserializer, Model): - return deserializer._deserialize(value, []) - return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) - except Exception as e: - raise DeserializationError() from e - - -def _deserialize( - deserializer: typing.Any, - value: typing.Any, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - if isinstance(value, PipelineResponse): - value = value.http_response.json() - if rf is None and format: - rf = _RestField(format=format) - if not isinstance(deserializer, functools.partial): - deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) - return _deserialize_with_callable(deserializer, value) - - -def _failsafe_deserialize( - deserializer: typing.Any, - response: HttpResponse, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - try: - return _deserialize(deserializer, response.json(), module, rf, format) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -def _failsafe_deserialize_xml( - deserializer: typing.Any, - response: HttpResponse, -) -> typing.Any: - try: - return _deserialize_xml(deserializer, response.text()) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -# pylint: disable=too-many-instance-attributes -class _RestField: - def __init__( - self, - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - is_discriminator: bool = False, - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, - ): - self._type = type - self._rest_name_input = name - self._module: typing.Optional[str] = None - self._is_discriminator = is_discriminator - self._visibility = visibility - self._is_model = False - self._is_optional = False - self._default = default - self._format = format - self._is_multipart_file_input = is_multipart_file_input - self._xml = xml if xml is not None else {} - self._deserializer = deserializer - - @property - def _class_type(self) -> typing.Any: - result = getattr(self._type, "args", [None])[0] - # type may be wrapped by nested functools.partial so we need to check for that - if isinstance(result, functools.partial): - return getattr(result, "args", [None])[0] - return result - - @property - def _rest_name(self) -> str: - if self._rest_name_input is None: - raise ValueError("Rest name was never set") - return self._rest_name_input - - def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin - # by this point, type and rest_name will have a value bc we default - # them in __new__ of the Model class - # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name, _UNSET) - if item is _UNSET: - # Field not set by user; return the client default if one exists, otherwise None - return self._default if self._default is not _UNSET else None - if item is None: - return item - if self._is_model: - return item - - # For mutable types, we want mutations to directly affect _data - # Check if we've already deserialized this value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - # Return the value from _data directly (it's been deserialized in place) - return obj._data.get(self._rest_name) - - # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) - if self._deserializer: - deserialized = self._deserializer(item) - else: - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) - - # For mutable types, store the deserialized value back in _data - # so mutations directly affect _data - if isinstance(deserialized, (dict, list, set)): - obj._data[self._rest_name] = deserialized - object.__setattr__(obj, cache_attr, True) # Mark as deserialized - return deserialized - - return deserialized - - def __set__(self, obj: Model, value) -> None: - # Clear the cached deserialized object when setting a new value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - object.__delattr__(obj, cache_attr) - - if value is None: - # we want to wipe out entries if users set attr to None - try: - obj.__delitem__(self._rest_name) - except KeyError: - pass - return - if self._is_model: - if not _is_model(value): - value = _deserialize(self._type, value) - obj.__setitem__(self._rest_name, value) - return - obj.__setitem__(self._rest_name, _serialize(value, self._format)) - - def _get_deserialize_callable_from_annotation( - self, annotation: typing.Any - ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - return _get_deserialize_callable_from_annotation(annotation, self._module, self) - - -def rest_field( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, -) -> typing.Any: - return _RestField( - name=name, - type=type, - visibility=visibility, - default=default, - format=format, - is_multipart_file_input=is_multipart_file_input, - xml=xml, - deserializer=deserializer, - ) - - -def rest_discriminator( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) - - -def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: - """Serialize a model to XML. - - :param Model model: The model to serialize. - :param bool exclude_readonly: Whether to exclude readonly properties. - :returns: The XML representation of the model. - :rtype: str - """ - return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore - - -def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: - """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. - - :param dict meta: The metadata dictionary to extract namespace from. - :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. - :rtype: str or None - """ - ns = meta.get("ns") - if ns is None: - ns = meta.get("namespace") - return ns - - -def _resolve_xml_ns( - prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None -) -> typing.Optional[str]: - """Resolve XML namespace for a property, falling back to model namespace when appropriate. - - Checks the property metadata first; if no namespace is found and the model does not declare - an explicit prefix, falls back to the model-level namespace. - - :param dict prop_meta: The property metadata dictionary. - :param dict model_meta: The model metadata dictionary, used as fallback. - :returns: The resolved namespace string, or None. - :rtype: str or None - """ - ns = _get_xml_ns(prop_meta) - if ns is None and model_meta is not None and not model_meta.get("prefix"): - ns = _get_xml_ns(model_meta) - return ns - - -def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: - """Set an XML attribute on an element, handling namespace prefix registration. - - :param ET.Element element: The element to set the attribute on. - :param str name: The default attribute name (wire name). - :param any value: The attribute value. - :param dict prop_meta: The property metadata dictionary. - """ - xml_name = prop_meta.get("name", name) - _attr_ns = _get_xml_ns(prop_meta) - if _attr_ns: - _attr_prefix = prop_meta.get("prefix") - if _attr_prefix: - _safe_register_namespace(_attr_prefix, _attr_ns) - xml_name = "{" + _attr_ns + "}" + xml_name - element.set(xml_name, _get_primitive_type_value(value)) - - -def _get_element( - o: typing.Any, - exclude_readonly: bool = False, - parent_meta: typing.Optional[dict[str, typing.Any]] = None, - wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, list[ET.Element]]: - if _is_model(o): - model_meta = getattr(o, "_xml", {}) - - # if prop is a model, then use the prop element directly, else generate a wrapper of model - if wrapped_element is None: - # When serializing as an array item (parent_meta is set), check if the parent has an - # explicit itemsName. This ensures correct element names for unwrapped arrays (where - # the element tag is the property/items name, not the model type name). - _items_name = parent_meta.get("itemsName") if parent_meta is not None else None - element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) - _model_ns = _get_xml_ns(model_meta) - wrapped_element = _create_xml_element( - element_name, - model_meta.get("prefix"), - _model_ns, - ) - - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - - for k, v in o.items(): - # do not serialize readonly properties - if exclude_readonly and k in readonly_props: - continue - - prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) - if prop_rest_field: - prop_meta = getattr(prop_rest_field, "_xml").copy() - # use the wire name as xml name if no specific name is set - if prop_meta.get("name") is None: - prop_meta["name"] = k - else: - # additional properties will not have rest field, use the wire name as xml name - prop_meta = {"name": k} - - # Propagate model namespace to properties only for old-style "ns"-keyed models. - # DPG-generated models use the "namespace" key and explicitly declare namespace on - # each property that needs it, so propagation is intentionally skipped for them. - if prop_meta.get("ns") is None and model_meta.get("ns"): - prop_meta["ns"] = model_meta.get("ns") - prop_meta["prefix"] = model_meta.get("prefix") - - if prop_meta.get("unwrapped", False): - # unwrapped could only set on array - wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) - elif prop_meta.get("text", False): - # text could only set on primitive type - wrapped_element.text = _get_primitive_type_value(v) - elif prop_meta.get("attribute", False): - _set_xml_attribute(wrapped_element, k, v, prop_meta) - else: - # other wrapped prop element - wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) - return wrapped_element - if isinstance(o, list): - return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore - if isinstance(o, dict): - result = [] - _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None - for k, v in o.items(): - result.append( - _get_wrapped_element( - v, - exclude_readonly, - { - "name": k, - "ns": _dict_ns, - "prefix": parent_meta.get("prefix") if parent_meta else None, - }, - ) - ) - return result - - # primitive case need to create element based on parent_meta - if parent_meta: - _items_ns = parent_meta.get("itemsNs") - if _items_ns is None: - _items_ns = _get_xml_ns(parent_meta) - return _get_wrapped_element( - o, - exclude_readonly, - { - "name": parent_meta.get("itemsName", parent_meta.get("name")), - "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": _items_ns, - }, - ) - - raise ValueError("Could not serialize value into xml: " + o) - - -def _get_wrapped_element( - v: typing.Any, - exclude_readonly: bool, - meta: typing.Optional[dict[str, typing.Any]], -) -> ET.Element: - _meta_ns = _get_xml_ns(meta) if meta else None - wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns - ) - if isinstance(v, (dict, list)): - wrapped_element.extend(_get_element(v, exclude_readonly, meta)) - elif _is_model(v): - _get_element(v, exclude_readonly, meta, wrapped_element) - else: - wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element # type: ignore[no-any-return] - - -def _get_primitive_type_value(v) -> str: - if v is True: - return "true" - if v is False: - return "false" - if isinstance(v, _Null): - return "" - return str(v) - - -def _safe_register_namespace(prefix: str, ns: str) -> None: - """Register an XML namespace prefix, handling reserved prefix patterns. - - Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for - auto-generated prefixes, causing register_namespace to raise ValueError. - Falls back to directly registering in the internal namespace map. - - :param str prefix: The namespace prefix to register. - :param str ns: The namespace URI. - """ - try: - ET.register_namespace(prefix, ns) - except ValueError: - _ns_map = getattr(ET, "_namespace_map", None) - if _ns_map is not None: - _ns_map[ns] = prefix - - -def _create_xml_element( - tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None -) -> ET.Element: - if prefix and ns: - _safe_register_namespace(prefix, ns) - if ns: - return ET.Element("{" + ns + "}" + tag) - return ET.Element(tag) - - -def _deserialize_xml( - deserializer: typing.Any, - value: str, -) -> typing.Any: - element = ET.fromstring(value) # nosec - if _is_model(deserializer): - return deserializer._deserialize(element, []) - return _deserialize(deserializer, element) - - -def _convert_element(e: ET.Element): - # dict case - if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: dict[str, typing.Any] = {} - for child in e: - if dict_result.get(child.tag) is not None: - if isinstance(dict_result[child.tag], list): - dict_result[child.tag].append(_convert_element(child)) - else: - dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] - else: - dict_result[child.tag] = _convert_element(child) - dict_result.update(e.attrib) - return dict_result - # array case - if len(e) > 0: - array_result: list[typing.Any] = [] - for child in e: - array_result.append(_convert_element(child)) - return array_result - # primitive case - return e.text diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/serialization.py deleted file mode 100644 index a088671e9c51..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/serialization.py +++ /dev/null @@ -1,2066 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # Fast path for header deserialization: response_data is a plain str or None - # and target_obj is a simple scalar type. This avoids the expensive - # _unpack_content → _deserialize → _classify_target → deserialize_data chain. - if response_data is None: - return None - if target_obj == "str" and isinstance(response_data, str): - return response_data - if isinstance(response_data, str): - if target_obj == "int": - return int(response_data) - if target_obj == "bool": - if response_data in ("true", "1", "True"): - return True - if response_data in ("false", "0", "False"): - return False - return bool(response_data) - if target_obj == "rfc-1123": - return Deserializer.deserialize_rfc(response_data) - if target_obj == "bytearray": - return Deserializer.deserialize_bytearray(response_data) - - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/utils.py deleted file mode 100644 index 35c9c836f85f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_version.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_version.py deleted file mode 100644 index be71c81bd282..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b1" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/__init__.py deleted file mode 100644 index 0d53c2e58ecb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import NotDiscriminatedClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "NotDiscriminatedClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_client.py deleted file mode 100644 index 4c9233196636..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_client.py +++ /dev/null @@ -1,101 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -import sys -from typing import Any, Awaitable - -from azure.core import AsyncPipelineClient -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .._utils.serialization import Deserializer, Serializer -from ._configuration import NotDiscriminatedClientConfiguration -from ._operations import _NotDiscriminatedClientOperationsMixin - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class NotDiscriminatedClient( - _NotDiscriminatedClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """Illustrates not-discriminated inheritance model. - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = NotDiscriminatedClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_configuration.py deleted file mode 100644 index 75fba1e755a1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from .._version import VERSION - - -class NotDiscriminatedClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for NotDiscriminatedClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-notdiscriminated-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/__init__.py deleted file mode 100644 index 55cfeb709325..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _NotDiscriminatedClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_operations.py deleted file mode 100644 index 0d25bc178b81..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_operations.py +++ /dev/null @@ -1,324 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import models as _models, types -from ..._operations._operations import ( - build_not_discriminated_get_valid_request, - build_not_discriminated_post_valid_request, - build_not_discriminated_put_valid_request, -) -from ..._utils.model_base import SdkJSONEncoder, _deserialize -from ..._utils.utils import ClientMixinABC -from .._configuration import NotDiscriminatedClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _NotDiscriminatedClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], NotDiscriminatedClientConfiguration] -): - - @overload - async def post_valid( - self, input: _models.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """post_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def post_valid(self, input: types.Siamese, *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.types.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def post_valid(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def post_valid(self, input: Union[_models.Siamese, types.Siamese, IO[bytes]], **kwargs: Any) -> None: - """post_valid. - - :param input: Is either a Siamese type or a IO[bytes] type. Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese or - ~typetest.model.notdiscriminated.typeddict.types.Siamese or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_not_discriminated_post_valid_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> _models.Siamese: - """get_valid. - - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Siamese] = kwargs.pop("cls", None) - - _request = build_not_discriminated_get_valid_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Siamese, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put_valid( - self, input: _models.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_valid( - self, input: types.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.types.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_valid( - self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_valid( - self, input: Union[_models.Siamese, types.Siamese, IO[bytes]], **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Is either a Siamese type or a IO[bytes] type. Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese or - ~typetest.model.notdiscriminated.typeddict.types.Siamese or IO[bytes] - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Siamese] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_not_discriminated_put_valid_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Siamese, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/__init__.py deleted file mode 100644 index 82917b2a4eea..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models import ( # type: ignore - Cat, - Pet, - Siamese, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Cat", - "Pet", - "Siamese", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_models.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_models.py deleted file mode 100644 index be87f1155dba..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_models.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 - -from typing import Any, Mapping, overload - -from .._utils.model_base import Model as _Model, rest_field - - -class Pet(_Model): - """This is base model for not-discriminated normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - """ - - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - name: str, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Cat(Pet): - """The second level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - """ - - age: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - name: str, - age: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Siamese(Cat): - """The third level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - :ivar smart: Required. - :vartype smart: bool - """ - - smart: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - name: str, - age: int, - smart: bool, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/py.typed b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/types.py deleted file mode 100644 index 3ff75a869b4b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/types.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Pet(TypedDict, total=False): - """This is base model for not-discriminated normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Cat(Pet): - """The second level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - """ - - age: Required[int] - """Required.""" - - -class Siamese(Cat): - """The third level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - :ivar smart: Required. - :vartype smart: bool - """ - - smart: Required[bool] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/types.py deleted file mode 100644 index 3ff75a869b4b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/types.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Pet(TypedDict, total=False): - """This is base model for not-discriminated normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Cat(Pet): - """The second level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - """ - - age: Required[int] - """Required.""" - - -class Siamese(Cat): - """The third level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - :ivar smart: Required. - :vartype smart: bool - """ - - smart: Required[bool] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/types.py deleted file mode 100644 index e188b395c2b3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-recursive/typetest/model/recursive/types.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class Element(TypedDict, total=False): - """element. - - :ivar extension: - :vartype extension: list[~typetest.model.recursive.models.Extension] - """ - - extension: list["Extension"] - - -class Extension(Element): - """extension. - - :ivar extension: - :vartype extension: list[~typetest.model.recursive.models.Extension] - :ivar level: Required. - :vartype level: int - """ - - level: Required[int] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/CHANGELOG.md deleted file mode 100644 index b957b2575b48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release History - -## 1.0.0b1 (1970-01-01) - -### Other Changes - - - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/LICENSE b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/LICENSE deleted file mode 100644 index 63447fd8bbbf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/MANIFEST.in b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/MANIFEST.in deleted file mode 100644 index f006a55bee75..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include *.md -include LICENSE -include typetest/model/singlediscriminator/typeddict/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include typetest/__init__.py -include typetest/model/__init__.py -include typetest/model/singlediscriminator/__init__.py diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/_metadata.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/_metadata.json deleted file mode 100644 index 49515fdbafdf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/_metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "apiVersions": {} -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/apiview-properties.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/apiview-properties.json deleted file mode 100644 index 3921b5baaa5d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/apiview-properties.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Inheritance.SingleDiscriminator", - "CrossLanguageDefinitionId": { - "typetest.model.singlediscriminator.typeddict.models.Bird": "Type.Model.Inheritance.SingleDiscriminator.Bird", - "typetest.model.singlediscriminator.typeddict.models.Dinosaur": "Type.Model.Inheritance.SingleDiscriminator.Dinosaur", - "typetest.model.singlediscriminator.typeddict.models.Eagle": "Type.Model.Inheritance.SingleDiscriminator.Eagle", - "typetest.model.singlediscriminator.typeddict.models.Goose": "Type.Model.Inheritance.SingleDiscriminator.Goose", - "typetest.model.singlediscriminator.typeddict.models.SeaGull": "Type.Model.Inheritance.SingleDiscriminator.SeaGull", - "typetest.model.singlediscriminator.typeddict.models.Sparrow": "Type.Model.Inheritance.SingleDiscriminator.Sparrow", - "typetest.model.singlediscriminator.typeddict.models.TRex": "Type.Model.Inheritance.SingleDiscriminator.TRex", - "typetest.model.singlediscriminator.typeddict.SingleDiscriminatorClient.get_model": "Type.Model.Inheritance.SingleDiscriminator.getModel", - "typetest.model.singlediscriminator.typeddict.aio.SingleDiscriminatorClient.get_model": "Type.Model.Inheritance.SingleDiscriminator.getModel", - "typetest.model.singlediscriminator.typeddict.SingleDiscriminatorClient.put_model": "Type.Model.Inheritance.SingleDiscriminator.putModel", - "typetest.model.singlediscriminator.typeddict.aio.SingleDiscriminatorClient.put_model": "Type.Model.Inheritance.SingleDiscriminator.putModel", - "typetest.model.singlediscriminator.typeddict.SingleDiscriminatorClient.get_recursive_model": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", - "typetest.model.singlediscriminator.typeddict.aio.SingleDiscriminatorClient.get_recursive_model": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", - "typetest.model.singlediscriminator.typeddict.SingleDiscriminatorClient.put_recursive_model": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", - "typetest.model.singlediscriminator.typeddict.aio.SingleDiscriminatorClient.put_recursive_model": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", - "typetest.model.singlediscriminator.typeddict.SingleDiscriminatorClient.get_missing_discriminator": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", - "typetest.model.singlediscriminator.typeddict.aio.SingleDiscriminatorClient.get_missing_discriminator": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", - "typetest.model.singlediscriminator.typeddict.SingleDiscriminatorClient.get_wrong_discriminator": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", - "typetest.model.singlediscriminator.typeddict.aio.SingleDiscriminatorClient.get_wrong_discriminator": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", - "typetest.model.singlediscriminator.typeddict.SingleDiscriminatorClient.get_legacy_model": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel", - "typetest.model.singlediscriminator.typeddict.aio.SingleDiscriminatorClient.get_legacy_model": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel" - }, - "CrossLanguageVersion": "301c4a3b5af0" -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/dev_requirements.txt b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/dev_requirements.txt deleted file mode 100644 index 0e53b6a72db5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/dev_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --e ../../../eng/tools/azure-sdk-tools -../../core/azure-core -aiohttp \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/conftest.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/conftest.py deleted file mode 100644 index 633ac1e52f0a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/conftest.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import os -import pytest -from dotenv import load_dotenv -from devtools_testutils import ( - test_proxy, - add_general_regex_sanitizer, - add_body_key_sanitizer, - add_header_regex_sanitizer, -) - -load_dotenv() - - -# For security, please avoid record sensitive identity information in recordings -@pytest.fixture(scope="session", autouse=True) -def add_sanitizers(test_proxy): - singlediscriminator_subscription_id = os.environ.get( - "SINGLEDISCRIMINATOR_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" - ) - singlediscriminator_tenant_id = os.environ.get( - "SINGLEDISCRIMINATOR_TENANT_ID", "00000000-0000-0000-0000-000000000000" - ) - singlediscriminator_client_id = os.environ.get( - "SINGLEDISCRIMINATOR_CLIENT_ID", "00000000-0000-0000-0000-000000000000" - ) - singlediscriminator_client_secret = os.environ.get( - "SINGLEDISCRIMINATOR_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" - ) - add_general_regex_sanitizer(regex=singlediscriminator_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=singlediscriminator_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=singlediscriminator_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=singlediscriminator_client_secret, value="00000000-0000-0000-0000-000000000000") - - add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") - add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/test_single_discriminator.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/test_single_discriminator.py deleted file mode 100644 index efc2bac6ce87..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/test_single_discriminator.py +++ /dev/null @@ -1,80 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import SingleDiscriminatorClientTestBase, SingleDiscriminatorPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestSingleDiscriminator(SingleDiscriminatorClientTestBase): - @SingleDiscriminatorPreparer() - @recorded_by_proxy - def test_get_model(self, singlediscriminator_endpoint): - client = self.create_client(endpoint=singlediscriminator_endpoint) - response = client.get_model() - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy - def test_put_model(self, singlediscriminator_endpoint): - client = self.create_client(endpoint=singlediscriminator_endpoint) - response = client.put_model( - input={"kind": "eagle", "wingspan": 0, "friends": ["bird"], "hate": {"str": "bird"}, "partner": "bird"}, - ) - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy - def test_get_recursive_model(self, singlediscriminator_endpoint): - client = self.create_client(endpoint=singlediscriminator_endpoint) - response = client.get_recursive_model() - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy - def test_put_recursive_model(self, singlediscriminator_endpoint): - client = self.create_client(endpoint=singlediscriminator_endpoint) - response = client.put_recursive_model( - input={"kind": "eagle", "wingspan": 0, "friends": ["bird"], "hate": {"str": "bird"}, "partner": "bird"}, - ) - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy - def test_get_missing_discriminator(self, singlediscriminator_endpoint): - client = self.create_client(endpoint=singlediscriminator_endpoint) - response = client.get_missing_discriminator() - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy - def test_get_wrong_discriminator(self, singlediscriminator_endpoint): - client = self.create_client(endpoint=singlediscriminator_endpoint) - response = client.get_wrong_discriminator() - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy - def test_get_legacy_model(self, singlediscriminator_endpoint): - client = self.create_client(endpoint=singlediscriminator_endpoint) - response = client.get_legacy_model() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/test_single_discriminator_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/test_single_discriminator_async.py deleted file mode 100644 index 96fc035088f9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/test_single_discriminator_async.py +++ /dev/null @@ -1,81 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import SingleDiscriminatorPreparer -from testpreparer_async import SingleDiscriminatorClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestSingleDiscriminatorAsync(SingleDiscriminatorClientTestBaseAsync): - @SingleDiscriminatorPreparer() - @recorded_by_proxy_async - async def test_get_model(self, singlediscriminator_endpoint): - client = self.create_async_client(endpoint=singlediscriminator_endpoint) - response = await client.get_model() - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy_async - async def test_put_model(self, singlediscriminator_endpoint): - client = self.create_async_client(endpoint=singlediscriminator_endpoint) - response = await client.put_model( - input={"kind": "eagle", "wingspan": 0, "friends": ["bird"], "hate": {"str": "bird"}, "partner": "bird"}, - ) - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy_async - async def test_get_recursive_model(self, singlediscriminator_endpoint): - client = self.create_async_client(endpoint=singlediscriminator_endpoint) - response = await client.get_recursive_model() - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy_async - async def test_put_recursive_model(self, singlediscriminator_endpoint): - client = self.create_async_client(endpoint=singlediscriminator_endpoint) - response = await client.put_recursive_model( - input={"kind": "eagle", "wingspan": 0, "friends": ["bird"], "hate": {"str": "bird"}, "partner": "bird"}, - ) - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy_async - async def test_get_missing_discriminator(self, singlediscriminator_endpoint): - client = self.create_async_client(endpoint=singlediscriminator_endpoint) - response = await client.get_missing_discriminator() - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy_async - async def test_get_wrong_discriminator(self, singlediscriminator_endpoint): - client = self.create_async_client(endpoint=singlediscriminator_endpoint) - response = await client.get_wrong_discriminator() - - # please add some check logic here by yourself - # ... - - @SingleDiscriminatorPreparer() - @recorded_by_proxy_async - async def test_get_legacy_model(self, singlediscriminator_endpoint): - client = self.create_async_client(endpoint=singlediscriminator_endpoint) - response = await client.get_legacy_model() - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/testpreparer.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/testpreparer.py deleted file mode 100644 index 802791274463..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/testpreparer.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer -import functools -from typetest.model.singlediscriminator.typeddict import SingleDiscriminatorClient - - -class SingleDiscriminatorClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(SingleDiscriminatorClient) - return self.create_client_from_credential( - SingleDiscriminatorClient, - credential=credential, - endpoint=endpoint, - ) - - -SingleDiscriminatorPreparer = functools.partial( - PowerShellPreparer, - "singlediscriminator", - singlediscriminator_endpoint="https://fake_singlediscriminator_endpoint.com", -) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/testpreparer_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/testpreparer_async.py deleted file mode 100644 index 809ad8d5b94a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/generated_tests/testpreparer_async.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase -from typetest.model.singlediscriminator.typeddict.aio import SingleDiscriminatorClient - - -class SingleDiscriminatorClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(SingleDiscriminatorClient, is_async=True) - return self.create_client_from_credential( - SingleDiscriminatorClient, - credential=credential, - endpoint=endpoint, - ) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/pyproject.toml b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/pyproject.toml deleted file mode 100644 index d32e779d393e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/pyproject.toml +++ /dev/null @@ -1,61 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -[build-system] -requires = ["setuptools>=77.0.3", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "typetest-model-singlediscriminator-typeddict" -authors = [ - { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, -] -description = "Microsoft Corporation Azure Typetest Model Singlediscriminator Typeddict Client Library for Python" -license = "MIT" -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", -] -requires-python = ">=3.10" -keywords = ["azure", "azure sdk"] - -dependencies = [ - "isodate>=0.6.1", - "azure-core>=1.37.0", - "typing-extensions>=4.6.0", -] -dynamic = [ -"version", "readme" -] - -[project.urls] -repository = "https://github.com/Azure/azure-sdk-for-python" - -[tool.setuptools.dynamic] -version = {attr = "typetest.model.singlediscriminator.typeddict._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} - -[tool.setuptools.packages.find] -exclude = [ - "tests*", - "generated_tests*", - "samples*", - "generated_samples*", - "doc*", - "typetest", - "typetest.model", - "typetest.model.singlediscriminator", -] - -[tool.setuptools.package-data] -pytyped = ["py.typed"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/__init__.py deleted file mode 100644 index acc9ddd564d7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import SingleDiscriminatorClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SingleDiscriminatorClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_client.py deleted file mode 100644 index 148a0ce62095..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_client.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -import sys -from typing import Any - -from azure.core import PipelineClient -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse - -from ._configuration import SingleDiscriminatorClientConfiguration -from ._operations import _SingleDiscriminatorClientOperationsMixin -from ._utils.serialization import Deserializer, Serializer - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class SingleDiscriminatorClient( - _SingleDiscriminatorClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """Illustrates inheritance with single discriminator. - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = SingleDiscriminatorClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_configuration.py deleted file mode 100644 index 600c2d70c752..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from ._version import VERSION - - -class SingleDiscriminatorClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for SingleDiscriminatorClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-singlediscriminator-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/__init__.py deleted file mode 100644 index 0d3d6a1e224d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _SingleDiscriminatorClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_operations.py deleted file mode 100644 index a8dba785e273..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_operations.py +++ /dev/null @@ -1,639 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models, types -from .._configuration import SingleDiscriminatorClientConfiguration -from .._utils.model_base import SdkJSONEncoder, _deserialize -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_single_discriminator_get_model_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/model" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_put_model_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/type/model/inheritance/single-discriminator/model" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_get_recursive_model_request( # pylint: disable=name-too-long - **kwargs: Any, -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/recursivemodel" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_put_recursive_model_request( # pylint: disable=name-too-long - **kwargs: Any, -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/type/model/inheritance/single-discriminator/recursivemodel" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_get_missing_discriminator_request( # pylint: disable=name-too-long - **kwargs: Any, -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/missingdiscriminator" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_get_wrong_discriminator_request( # pylint: disable=name-too-long - **kwargs: Any, -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/wrongdiscriminator" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_get_legacy_model_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/legacy-model" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -class _SingleDiscriminatorClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], SingleDiscriminatorClientConfiguration] -): - - @distributed_trace - def get_model(self, **kwargs: Any) -> _models.Bird: - """get_model. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put_model(self, input: _models.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_model(self, input: types.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.types.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_model(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_model( # pylint: disable=inconsistent-return-statements - self, input: Union[_models.Bird, types.Bird, IO[bytes]], **kwargs: Any - ) -> None: - """put_model. - - :param input: Is either a Bird type or a IO[bytes] type. Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird or - ~typetest.model.singlediscriminator.typeddict.types.Bird or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_single_discriminator_put_model_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_recursive_model(self, **kwargs: Any) -> _models.Bird: - """get_recursive_model. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_recursive_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put_recursive_model( - self, input: _models.Bird, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_recursive_model(self, input: types.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_recursive_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.types.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_recursive_model(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_recursive_model. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_recursive_model( # pylint: disable=inconsistent-return-statements - self, input: Union[_models.Bird, types.Bird, IO[bytes]], **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Is either a Bird type or a IO[bytes] type. Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird or - ~typetest.model.singlediscriminator.typeddict.types.Bird or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_single_discriminator_put_recursive_model_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_missing_discriminator(self, **kwargs: Any) -> _models.Bird: - """get_missing_discriminator. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_missing_discriminator_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_wrong_discriminator(self, **kwargs: Any) -> _models.Bird: - """get_wrong_discriminator. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_wrong_discriminator_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_legacy_model(self, **kwargs: Any) -> _models.Dinosaur: - """get_legacy_model. - - :return: Dinosaur. The Dinosaur is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Dinosaur - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Dinosaur] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_legacy_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Dinosaur, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/__init__.py deleted file mode 100644 index 8026245c2abc..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/model_base.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/model_base.py deleted file mode 100644 index d725c55906d3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/model_base.py +++ /dev/null @@ -1,1737 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=protected-access, broad-except - -import copy -import calendar -import decimal -import functools -import sys -import logging -import base64 -import re -import typing -import enum -import email.utils -from datetime import datetime, date, time, timedelta, timezone -from json import JSONEncoder -import xml.etree.ElementTree as ET -from collections.abc import MutableMapping -import isodate -from azure.core.exceptions import DeserializationError -from azure.core import CaseInsensitiveEnumMeta -from azure.core.pipeline import PipelineResponse -from azure.core.serialization import _Null - -from azure.core.rest import HttpResponse - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_LOGGER = logging.getLogger(__name__) - -__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] - -TZ_UTC = timezone.utc -_T = typing.TypeVar("_T") -_NONE_TYPE = type(None) - - -def _timedelta_as_isostr(td: timedelta) -> str: - """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' - - Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython - - :param timedelta td: The timedelta to convert - :rtype: str - :return: ISO8601 version of this timedelta - """ - - # Split seconds to larger units - seconds = td.total_seconds() - minutes, seconds = divmod(seconds, 60) - hours, minutes = divmod(minutes, 60) - days, hours = divmod(hours, 24) - - days, hours, minutes = list(map(int, (days, hours, minutes))) - seconds = round(seconds, 6) - - # Build date - date_str = "" - if days: - date_str = "%sD" % days - - if hours or minutes or seconds: - # Build time - time_str = "T" - - # Hours - bigger_exists = date_str or hours - if bigger_exists: - time_str += "{:02}H".format(hours) - - # Minutes - bigger_exists = bigger_exists or minutes - if bigger_exists: - time_str += "{:02}M".format(minutes) - - # Seconds - try: - if seconds.is_integer(): - seconds_string = "{:02}".format(int(seconds)) - else: - # 9 chars long w/ leading 0, 6 digits after decimal - seconds_string = "%09.6f" % seconds - # Remove trailing zeros - seconds_string = seconds_string.rstrip("0") - except AttributeError: # int.is_integer() raises - seconds_string = "{:02}".format(seconds) - - time_str += "{}S".format(seconds_string) - else: - time_str = "" - - return "P" + date_str + time_str - - -def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: - encoded = base64.b64encode(o).decode() - if format == "base64url": - return encoded.strip("=").replace("+", "-").replace("/", "_") - return encoded - - -def _serialize_datetime(o, format: typing.Optional[str] = None): - if hasattr(o, "year") and hasattr(o, "hour"): - if format == "rfc7231": - return email.utils.format_datetime(o, usegmt=True) - if format == "unix-timestamp": - return int(calendar.timegm(o.utctimetuple())) - - # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) - if not o.tzinfo: - iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() - else: - iso_formatted = o.astimezone(TZ_UTC).isoformat() - # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) - return iso_formatted.replace("+00:00", "Z") - # Next try datetime.date or datetime.time - return o.isoformat() - - -def _is_readonly(p): - try: - return p._visibility == ["read"] - except AttributeError: - return False - - -class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" - - def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): - super().__init__(*args, **kwargs) - self.exclude_readonly = exclude_readonly - self.format = format - - def default(self, o): # pylint: disable=too-many-return-statements - if _is_model(o): - if self.exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - return {k: v for k, v in o.items() if k not in readonly_props} - return dict(o.items()) - try: - return super(SdkJSONEncoder, self).default(o) - except TypeError: - if isinstance(o, _Null): - return None - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, self.format) - try: - # First try datetime.datetime - return _serialize_datetime(o, self.format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return super(SdkJSONEncoder, self).default(o) - - -_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") -_VALID_RFC7231 = re.compile( - r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" - r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" -) - -_ARRAY_ENCODE_MAPPING = { - "pipeDelimited": "|", - "spaceDelimited": " ", - "commaDelimited": ",", - "newlineDelimited": "\n", -} - - -def _deserialize_array_encoded(delimit: str, attr): - if isinstance(attr, str): - if attr == "": - return [] - return attr.split(delimit) - return attr - - -def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - attr = attr.upper() - match = _VALID_DATE.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - return date_obj # type: ignore[no-any-return] - - -def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize RFC7231 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - match = _VALID_RFC7231.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - return email.utils.parsedate_to_datetime(attr) - - -def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: - """Deserialize unix timestamp into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - return datetime.fromtimestamp(attr, TZ_UTC) - - -def _deserialize_date(attr: typing.Union[str, date]) -> date: - """Deserialize ISO-8601 formatted string into Date object. - :param str attr: response string to be deserialized. - :rtype: date - :returns: The date object from that input - """ - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - if isinstance(attr, date): - return attr - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore - - -def _deserialize_time(attr: typing.Union[str, time]) -> time: - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :returns: The time object from that input - """ - if isinstance(attr, time): - return attr - return isodate.parse_time(attr) # type: ignore[no-any-return] - - -def _deserialize_bytes(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - return bytes(base64.b64decode(attr)) - - -def _deserialize_bytes_base64(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return bytes(base64.b64decode(encoded)) - - -def _deserialize_duration(attr): - if isinstance(attr, timedelta): - return attr - return isodate.parse_duration(attr) - - -def _deserialize_decimal(attr): - if isinstance(attr, decimal.Decimal): - return attr - return decimal.Decimal(str(attr)) - - -def _deserialize_int_as_str(attr): - if isinstance(attr, int): - return attr - return int(attr) - - -_DESERIALIZE_MAPPING = { - datetime: _deserialize_datetime, - date: _deserialize_date, - time: _deserialize_time, - bytes: _deserialize_bytes, - bytearray: _deserialize_bytes, - timedelta: _deserialize_duration, - typing.Any: lambda x: x, - decimal.Decimal: _deserialize_decimal, -} - -_DESERIALIZE_MAPPING_WITHFORMAT = { - "rfc3339": _deserialize_datetime, - "rfc7231": _deserialize_datetime_rfc7231, - "unix-timestamp": _deserialize_datetime_unix_timestamp, - "base64": _deserialize_bytes, - "base64url": _deserialize_bytes_base64, -} - - -def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): - if annotation is int and rf and rf._format == "str": - return _deserialize_int_as_str - if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: - return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) - if rf and rf._format: - return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) - return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore - - -def _get_type_alias_type(module_name: str, alias_name: str): - types = { - k: v - for k, v in sys.modules[module_name].__dict__.items() - if isinstance(v, typing._GenericAlias) # type: ignore - } - if alias_name not in types: - return alias_name - return types[alias_name] - - -def _get_model(module_name: str, model_name: str): - models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} - module_end = module_name.rsplit(".", 1)[0] - models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) - if isinstance(model_name, str): - model_name = model_name.split(".")[-1] - if model_name not in models: - return model_name - return models[model_name] - - -_UNSET = object() - - -class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: dict[str, typing.Any]) -> None: - self._data = data - - def __contains__(self, key: typing.Any) -> bool: - return key in self._data - - def __getitem__(self, key: str) -> typing.Any: - # If this key has been deserialized (for mutable types), we need to handle serialization - if hasattr(self, "_attr_to_rest_field"): - cache_attr = f"_deserialized_{key}" - if hasattr(self, cache_attr): - rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) - if rf: - value = self._data.get(key) - if isinstance(value, (dict, list, set)): - # For mutable types, serialize and return - # But also update _data with serialized form and clear flag - # so mutations via this returned value affect _data - serialized = _serialize(value, rf._format) - # If serialized form is same type (no transformation needed), - # return _data directly so mutations work - if isinstance(serialized, type(value)) and serialized == value: - return self._data.get(key) - # Otherwise return serialized copy and clear flag - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - # Store serialized form back - self._data[key] = serialized - return serialized - return self._data.__getitem__(key) - - def __setitem__(self, key: str, value: typing.Any) -> None: - # Clear any cached deserialized value when setting through dictionary access - cache_attr = f"_deserialized_{key}" - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - self._data.__setitem__(key, value) - - def __delitem__(self, key: str) -> None: - self._data.__delitem__(key) - - def __iter__(self) -> typing.Iterator[typing.Any]: - return self._data.__iter__() - - def __len__(self) -> int: - return self._data.__len__() - - def __ne__(self, other: typing.Any) -> bool: - return not self.__eq__(other) - - def keys(self) -> typing.KeysView[str]: - """ - :returns: a set-like object providing a view on D's keys - :rtype: ~typing.KeysView - """ - return self._data.keys() - - def values(self) -> typing.ValuesView[typing.Any]: - """ - :returns: an object providing a view on D's values - :rtype: ~typing.ValuesView - """ - return self._data.values() - - def items(self) -> typing.ItemsView[str, typing.Any]: - """ - :returns: set-like object providing a view on D's items - :rtype: ~typing.ItemsView - """ - return self._data.items() - - def get(self, key: str, default: typing.Any = None) -> typing.Any: - """ - Get the value for key if key is in the dictionary, else default. - :param str key: The key to look up. - :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. - :rtype: any - """ - try: - return self[key] - except KeyError: - return default - - @typing.overload - def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ - - @typing.overload - def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs - - @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Removes specified key and return the corresponding value. - :param str key: The key to pop. - :param any default: The value to return if key is not in the dictionary - :returns: The value corresponding to the key. - :rtype: any - :raises KeyError: If key is not found and default is not given. - """ - if default is _UNSET: - return self._data.pop(key) - return self._data.pop(key, default) - - def popitem(self) -> tuple[str, typing.Any]: - """ - Removes and returns some (key, value) pair - :returns: The (key, value) pair. - :rtype: tuple - :raises KeyError: if D is empty. - """ - return self._data.popitem() - - def clear(self) -> None: - """ - Remove all items from D. - """ - self._data.clear() - - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ - """ - Updates D from mapping/iterable E and F. - :param any args: Either a mapping object or an iterable of key-value pairs. - """ - self._data.update(*args, **kwargs) - - @typing.overload - def setdefault(self, key: str, default: None = None) -> None: ... - - @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Same as calling D.get(k, d), and setting D[k]=d if k not found - :param str key: The key to look up. - :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. - :rtype: any - """ - if default is _UNSET: - return self._data.setdefault(key) - return self._data.setdefault(key, default) - - def __eq__(self, other: typing.Any) -> bool: - if isinstance(other, _MyMutableMapping): - return self._data == other._data - try: - other_model = self.__class__(other) - except Exception: - return False - return self._data == other_model._data - - def __repr__(self) -> str: - return str(self._data) - - -def _is_model(obj: typing.Any) -> bool: - return getattr(obj, "_is_model", False) - - -def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements - if isinstance(o, list): - if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): - return _ARRAY_ENCODE_MAPPING[format].join(o) - return [_serialize(x, format) for x in o] - if isinstance(o, dict): - return {k: _serialize(v, format) for k, v in o.items()} - if isinstance(o, set): - return {_serialize(x, format) for x in o} - if isinstance(o, tuple): - return tuple(_serialize(x, format) for x in o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, format) - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, enum.Enum): - return o.value - if isinstance(o, int): - if format == "str": - return str(o) - return o - try: - # First try datetime.datetime - return _serialize_datetime(o, format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return o - - -def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: - try: - return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) - except StopIteration: - return None - - -def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: - if not rf: - return _serialize(value, None) - if rf._is_multipart_file_input: - return value - if rf._is_model: - return _deserialize(rf._type, value) - if isinstance(value, ET.Element): - value = _deserialize(rf._type, value) - return _serialize(value, rf._format) - - -# ============================================================================ -# Fast-path scalar deserializer functions for rest_field(deserializer=...) -# These are referenced from rest_field declarations to bypass the generic -# _deserialize -> _deserialize_with_callable chain. -# Only simple/primitive types — no models or container types. -# ============================================================================ - - -def _xml_deser_str(value): - if isinstance(value, ET.Element): - return value.text or "" - return str(value) if value is not None else None - - -def _xml_deser_int(value): - if isinstance(value, ET.Element): - return int(value.text) if value.text else None - return int(value) if value is not None else None - - -def _xml_deser_float(value): - if isinstance(value, ET.Element): - return float(value.text) if value.text else None - return float(value) if value is not None else None - - -def _xml_deser_bool(value): - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - if text in (True, False): - return text - return text.lower() == "true" - - -# pylint: disable=docstring-missing-param -def _xml_deser_bytes(value): - """Deserialize bytes from XML (base64).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes(text) - - -def _xml_deser_bytes_base64url(value): - """Deserialize bytes from XML (base64url).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes_base64(text) - - -def _xml_deser_datetime(value): - """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime(text) - - -def _xml_deser_datetime_rfc7231(value): - """Deserialize a datetime from XML (RFC7231 format).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_rfc7231(text) - - -def _xml_deser_datetime_unix_timestamp(value): - """Deserialize a datetime from XML (Unix timestamp).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_unix_timestamp(float(text)) - - -def _xml_deser_date(value): - """Deserialize a date from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_date(text) - - -def _xml_deser_time(value): - """Deserialize a time from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_time(text) - - -def _xml_deser_duration(value): - """Deserialize a timedelta from XML (ISO 8601 duration).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_duration(text) - - -def _xml_deser_decimal(value): - """Deserialize a Decimal from XML.""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_decimal(text) - - -def _xml_deser_enum_or_str(enum_cls, value): - """Deserialize a Union[EnumType, str] from XML.""" - text = value.text if isinstance(value, ET.Element) else value - if text is None: - return None - try: - return enum_cls(text) - except ValueError: - return text - - -def _extract_xml_model_type(rf_type): - """Extract the concrete Model class from a resolved rf._type partial chain. - - Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` - wrappers. Only handles Model and Optional[Model] — other composite - types (List, Dict, Union, etc.) return None and fall through to the - generic ``_deserialize`` path at runtime. - """ - if rf_type is None: - return None - if isinstance(rf_type, type) and _is_model(rf_type): - return rf_type - if not isinstance(rf_type, functools.partial): - return None - func = rf_type.func - args = rf_type.args - if func is _deserialize_with_optional and args: - return _extract_xml_model_type(args[0]) - if func is _deserialize_model and args: - cls = args[0] - return cls if isinstance(cls, type) and _is_model(cls) else None - return None - - -def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable - cls, attr_to_rest_field: dict -) -> list: - """Build a precomputed XML field plan for fast _init_from_xml iteration. - - Called once per model class in __new__. Returns a list of tuples: - (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) - - kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text - - For Model and Optional[Model] fields that lack a scalar - ``_deserializer``, this function precomputes the Model class as the - deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` - directly instead of going through the expensive - ``_get_deserialize_callable_from_annotation`` chain at runtime. - """ - model_meta = getattr(cls, "_xml", {}) - model_ns = model_meta.get("ns") or model_meta.get("namespace") - plan = [] - - for rf in attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - deser = rf._deserializer - - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - is_optional = rf._is_optional - - # For Model / Optional[Model] fields without a scalar deserializer, - # precompute the Model class as the deserializer. - if deser is None and rf._type is not None: - model_cls = _extract_xml_model_type(rf._type) - if model_cls is not None: - deser = model_cls - - if prop_meta.get("attribute", False): - plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) - elif prop_meta.get("unwrapped", False): - items_name = prop_meta.get("itemsName") - if items_name: - items_ns = prop_meta.get("itemsNs") - if items_ns is not None: - xml_ns = items_ns - if xml_ns: - items_name = "{" + xml_ns + "}" + items_name - else: - items_name = xml_name - plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) - elif prop_meta.get("text", False): - plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) - else: - plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) - - return plan - - -# pylint: enable=docstring-missing-param -class Model(_MyMutableMapping): - _is_model = True - # label whether current class's _attr_to_rest_field has been calculated - # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: set[str] = set() - - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: - class_name = self.__class__.__name__ - if len(args) > 1: - raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass: dict[str, typing.Any] = {} - if args: - if isinstance(args[0], ET.Element): - dict_to_pass.update(self._init_from_xml(args[0])) - else: - dict_to_pass.update( - {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} - ) - else: - non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] - if non_attr_kwargs: - # actual type errors only throw the first wrong keyword arg they see, so following that. - raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") - dict_to_pass.update( - { - self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) - for k, v in kwargs.items() - if v is not None - } - ) - # Apply client default values for fields the caller didn't set so that - # defaults are part of `_data` and therefore included during serialization. - for rf in self._attr_to_rest_field.values(): - if rf._default is _UNSET: - continue - if rf._rest_name in dict_to_pass: - continue - dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) - super().__init__(dict_to_pass) - - def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements - self, element: ET.Element - ) -> dict[str, typing.Any]: - """Deserialize an XML element into a dict mapping rest field names to values. - - :param ET.Element element: The XML element to deserialize from. - :returns: A dictionary of rest_name to deserialized value pairs. - :rtype: dict - """ - result: dict[str, typing.Any] = {} - existed_attr_keys: list[str] = [] - - field_plan = getattr(self, "_xml_field_plan", None) - if field_plan: - for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: - if kind == 0: # wrapped element (most common) - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(item) - else: - result[rest_name] = _deserialize(rf_type, item) - elif kind == 1: # attribute - attr_val = element.get(xml_name) - if attr_val is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(attr_val) - else: - result[rest_name] = attr_val - elif kind == 2: # unwrapped array - items = element.findall(items_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(items_name) - if deser: - result[rest_name] = deser(items) - else: - result[rest_name] = _deserialize(rf_type, items) - elif not is_optional: - existed_attr_keys.append(items_name) - result[rest_name] = [] - elif kind == 3: # text - if element.text is not None: - if deser: - result[rest_name] = deser(element.text) - else: - result[rest_name] = element.text - else: - model_meta = getattr(self, "_xml", {}) - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in element: - if e.tag not in existed_attr_keys: - result[e.tag] = _convert_element(e) - - return result - - def copy(self) -> "Model": - return Model(self.__dict__) - - 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' - mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property - k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") - } - annotations = { - k: v - for mro_class in mros - 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__ - if not rf._type: - rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) - if not rf._rest_name_input: - rf._rest_name_input = attr - cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) - # Build XML field plan for fast _init_from_xml (only for XML models) - if getattr(cls, "_xml", None): - cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) - cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - - return super().__new__(cls) - - def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: - for base in cls.__bases__: - if hasattr(base, "__mapping__"): - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore - - @classmethod - def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: - for v in cls.__dict__.values(): - if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: - return v - return None - - @classmethod - def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): - return cls(data) - discriminator = cls._get_discriminator(exist_discriminators) - if discriminator is None: - return cls(data) - exist_discriminators.append(discriminator._rest_name) - if isinstance(data, ET.Element): - model_meta = getattr(cls, "_xml", {}) - prop_meta = getattr(discriminator, "_xml", {}) - xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - if data.get(xml_name) is not None: - discriminator_value = data.get(xml_name) - else: - 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 - return mapped_cls._deserialize(data, exist_discriminators) - - def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: - """Return a dict that can be turned into json using json.dump. - - :keyword bool exclude_readonly: Whether to remove the readonly properties. - :returns: A dict JSON compatible object - :rtype: dict - """ - - result = {} - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] - for k, v in self.items(): - if exclude_readonly and k in readonly_props: # pyright: ignore - continue - is_multipart_file_input = False - try: - is_multipart_file_input = next( - rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k - )._is_multipart_file_input - except StopIteration: - pass - result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) - return result - - @staticmethod - def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: - if v is None or isinstance(v, _Null): - return None - if isinstance(v, (list, tuple, set)): - return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) - if isinstance(v, dict): - return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} - return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v - - -def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - - -def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - -def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - - -def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj: dict[typing.Any, typing.Any], -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = {child.tag: child for child in obj} - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - - -def _deserialize_multiple_sequence( - entry_deserializers: list[typing.Optional[typing.Callable]], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) - - -def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: - return ( - isinstance(deserializer, functools.partial) - and isinstance(deserializer.args[0], functools.partial) - and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable - ) - - -def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = list(obj) - - # encoded string may be deserialized to sequence - if isinstance(obj, str) and isinstance(deserializer, functools.partial): - # for list[str] - if _is_array_encoded_deserializer(deserializer): - return deserializer(obj) - - # for list[Union[...]] - if isinstance(deserializer.args[0], list): - for sub_deserializer in deserializer.args[0]: - if _is_array_encoded_deserializer(sub_deserializer): - return sub_deserializer(obj) - - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - -def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: - return sorted( - types, - key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), - ) - - -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches - annotation: typing.Any, - module: typing.Optional[str], - rf: typing.Optional["_RestField"] = None, -) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - if not annotation: - return None - - # is it a type alias? - if isinstance(annotation, str): - if module is not None: - annotation = _get_type_alias_type(module, annotation) - - # is it a forward ref / in quotes? - if isinstance(annotation, (str, typing.ForwardRef)): - try: - model_name = annotation.__forward_arg__ # type: ignore - except AttributeError: - model_name = annotation - if module is not None: - annotation = _get_model(module, model_name) # type: ignore - - try: - if module and _is_model(annotation): - if rf: - rf._is_model = True - - return functools.partial(_deserialize_model, annotation) # pyright: ignore - except Exception: - pass - - # is it a literal? - try: - if annotation.__origin__ is typing.Literal: # pyright: ignore - return None - except AttributeError: - pass - - # is it optional? - try: - if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore - if rf: - rf._is_optional = True - if len(annotation.__args__) <= 2: # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) - # the type is Optional[Union[...]], we need to remove the None type from the Union - annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore - return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) - except AttributeError: - pass - - # is it union? - if getattr(annotation, "__origin__", None) is typing.Union: - # initial ordering is we make `string` the last deserialization option, because it is often them most generic - deserializers = [ - _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in _sorted_annotations(annotation.__args__) # pyright: ignore - ] - - return functools.partial(_deserialize_with_union, deserializers) - - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() == "dict": - value_deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[1], module, rf # pyright: ignore - ) - - return functools.partial( - _deserialize_dict, - value_deserializer, - module, - ) - except (AttributeError, IndexError): - pass - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: - if len(annotation.__args__) > 1: # pyright: ignore - entry_deserializers = [ - _get_deserialize_callable_from_annotation(dt, module, rf) - for dt in annotation.__args__ # pyright: ignore - ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) - deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[0], module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_sequence, deserializer, module) - except (TypeError, IndexError, AttributeError, SyntaxError): - pass - - def _deserialize_default( - deserializer, - obj, - ): - if obj is None: - return obj - try: - return _deserialize_with_callable(deserializer, obj) - except Exception: - pass - return obj - - if get_deserializer(annotation, rf): - return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) - - return functools.partial(_deserialize_default, annotation) - - -def _deserialize_with_callable( - deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], - value: typing.Any, -): # pylint: disable=too-many-return-statements - try: - if value is None or isinstance(value, _Null): - return None - if isinstance(value, ET.Element): - if deserializer is str: - return value.text or "" - if deserializer is int: - return int(value.text) if value.text else None - if deserializer is float: - return float(value.text) if value.text else None - if deserializer is bool: - return value.text == "true" if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): - return deserializer(value.text) if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): - return deserializer(value.text) if value.text else None - if deserializer is None: - return value - if deserializer in [int, float, bool]: - return deserializer(value) - if isinstance(deserializer, CaseInsensitiveEnumMeta): - try: - return deserializer(value.text if isinstance(value, ET.Element) else value) - except ValueError: - # for unknown value, return raw value - return value.text if isinstance(value, ET.Element) else value - if isinstance(deserializer, type) and issubclass(deserializer, Model): - return deserializer._deserialize(value, []) - return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) - except Exception as e: - raise DeserializationError() from e - - -def _deserialize( - deserializer: typing.Any, - value: typing.Any, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - if isinstance(value, PipelineResponse): - value = value.http_response.json() - if rf is None and format: - rf = _RestField(format=format) - if not isinstance(deserializer, functools.partial): - deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) - return _deserialize_with_callable(deserializer, value) - - -def _failsafe_deserialize( - deserializer: typing.Any, - response: HttpResponse, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - try: - return _deserialize(deserializer, response.json(), module, rf, format) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -def _failsafe_deserialize_xml( - deserializer: typing.Any, - response: HttpResponse, -) -> typing.Any: - try: - return _deserialize_xml(deserializer, response.text()) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -# pylint: disable=too-many-instance-attributes -class _RestField: - def __init__( - self, - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - is_discriminator: bool = False, - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, - ): - self._type = type - self._rest_name_input = name - self._module: typing.Optional[str] = None - self._is_discriminator = is_discriminator - self._visibility = visibility - self._is_model = False - self._is_optional = False - self._default = default - self._format = format - self._is_multipart_file_input = is_multipart_file_input - self._xml = xml if xml is not None else {} - self._deserializer = deserializer - - @property - def _class_type(self) -> typing.Any: - result = getattr(self._type, "args", [None])[0] - # type may be wrapped by nested functools.partial so we need to check for that - if isinstance(result, functools.partial): - return getattr(result, "args", [None])[0] - return result - - @property - def _rest_name(self) -> str: - if self._rest_name_input is None: - raise ValueError("Rest name was never set") - return self._rest_name_input - - def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin - # by this point, type and rest_name will have a value bc we default - # them in __new__ of the Model class - # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name, _UNSET) - if item is _UNSET: - # Field not set by user; return the client default if one exists, otherwise None - return self._default if self._default is not _UNSET else None - if item is None: - return item - if self._is_model: - return item - - # For mutable types, we want mutations to directly affect _data - # Check if we've already deserialized this value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - # Return the value from _data directly (it's been deserialized in place) - return obj._data.get(self._rest_name) - - # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) - if self._deserializer: - deserialized = self._deserializer(item) - else: - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) - - # For mutable types, store the deserialized value back in _data - # so mutations directly affect _data - if isinstance(deserialized, (dict, list, set)): - obj._data[self._rest_name] = deserialized - object.__setattr__(obj, cache_attr, True) # Mark as deserialized - return deserialized - - return deserialized - - def __set__(self, obj: Model, value) -> None: - # Clear the cached deserialized object when setting a new value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - object.__delattr__(obj, cache_attr) - - if value is None: - # we want to wipe out entries if users set attr to None - try: - obj.__delitem__(self._rest_name) - except KeyError: - pass - return - if self._is_model: - if not _is_model(value): - value = _deserialize(self._type, value) - obj.__setitem__(self._rest_name, value) - return - obj.__setitem__(self._rest_name, _serialize(value, self._format)) - - def _get_deserialize_callable_from_annotation( - self, annotation: typing.Any - ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - return _get_deserialize_callable_from_annotation(annotation, self._module, self) - - -def rest_field( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, -) -> typing.Any: - return _RestField( - name=name, - type=type, - visibility=visibility, - default=default, - format=format, - is_multipart_file_input=is_multipart_file_input, - xml=xml, - deserializer=deserializer, - ) - - -def rest_discriminator( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) - - -def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: - """Serialize a model to XML. - - :param Model model: The model to serialize. - :param bool exclude_readonly: Whether to exclude readonly properties. - :returns: The XML representation of the model. - :rtype: str - """ - return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore - - -def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: - """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. - - :param dict meta: The metadata dictionary to extract namespace from. - :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. - :rtype: str or None - """ - ns = meta.get("ns") - if ns is None: - ns = meta.get("namespace") - return ns - - -def _resolve_xml_ns( - prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None -) -> typing.Optional[str]: - """Resolve XML namespace for a property, falling back to model namespace when appropriate. - - Checks the property metadata first; if no namespace is found and the model does not declare - an explicit prefix, falls back to the model-level namespace. - - :param dict prop_meta: The property metadata dictionary. - :param dict model_meta: The model metadata dictionary, used as fallback. - :returns: The resolved namespace string, or None. - :rtype: str or None - """ - ns = _get_xml_ns(prop_meta) - if ns is None and model_meta is not None and not model_meta.get("prefix"): - ns = _get_xml_ns(model_meta) - return ns - - -def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: - """Set an XML attribute on an element, handling namespace prefix registration. - - :param ET.Element element: The element to set the attribute on. - :param str name: The default attribute name (wire name). - :param any value: The attribute value. - :param dict prop_meta: The property metadata dictionary. - """ - xml_name = prop_meta.get("name", name) - _attr_ns = _get_xml_ns(prop_meta) - if _attr_ns: - _attr_prefix = prop_meta.get("prefix") - if _attr_prefix: - _safe_register_namespace(_attr_prefix, _attr_ns) - xml_name = "{" + _attr_ns + "}" + xml_name - element.set(xml_name, _get_primitive_type_value(value)) - - -def _get_element( - o: typing.Any, - exclude_readonly: bool = False, - parent_meta: typing.Optional[dict[str, typing.Any]] = None, - wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, list[ET.Element]]: - if _is_model(o): - model_meta = getattr(o, "_xml", {}) - - # if prop is a model, then use the prop element directly, else generate a wrapper of model - if wrapped_element is None: - # When serializing as an array item (parent_meta is set), check if the parent has an - # explicit itemsName. This ensures correct element names for unwrapped arrays (where - # the element tag is the property/items name, not the model type name). - _items_name = parent_meta.get("itemsName") if parent_meta is not None else None - element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) - _model_ns = _get_xml_ns(model_meta) - wrapped_element = _create_xml_element( - element_name, - model_meta.get("prefix"), - _model_ns, - ) - - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - - for k, v in o.items(): - # do not serialize readonly properties - if exclude_readonly and k in readonly_props: - continue - - prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) - if prop_rest_field: - prop_meta = getattr(prop_rest_field, "_xml").copy() - # use the wire name as xml name if no specific name is set - if prop_meta.get("name") is None: - prop_meta["name"] = k - else: - # additional properties will not have rest field, use the wire name as xml name - prop_meta = {"name": k} - - # Propagate model namespace to properties only for old-style "ns"-keyed models. - # DPG-generated models use the "namespace" key and explicitly declare namespace on - # each property that needs it, so propagation is intentionally skipped for them. - if prop_meta.get("ns") is None and model_meta.get("ns"): - prop_meta["ns"] = model_meta.get("ns") - prop_meta["prefix"] = model_meta.get("prefix") - - if prop_meta.get("unwrapped", False): - # unwrapped could only set on array - wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) - elif prop_meta.get("text", False): - # text could only set on primitive type - wrapped_element.text = _get_primitive_type_value(v) - elif prop_meta.get("attribute", False): - _set_xml_attribute(wrapped_element, k, v, prop_meta) - else: - # other wrapped prop element - wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) - return wrapped_element - if isinstance(o, list): - return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore - if isinstance(o, dict): - result = [] - _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None - for k, v in o.items(): - result.append( - _get_wrapped_element( - v, - exclude_readonly, - { - "name": k, - "ns": _dict_ns, - "prefix": parent_meta.get("prefix") if parent_meta else None, - }, - ) - ) - return result - - # primitive case need to create element based on parent_meta - if parent_meta: - _items_ns = parent_meta.get("itemsNs") - if _items_ns is None: - _items_ns = _get_xml_ns(parent_meta) - return _get_wrapped_element( - o, - exclude_readonly, - { - "name": parent_meta.get("itemsName", parent_meta.get("name")), - "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": _items_ns, - }, - ) - - raise ValueError("Could not serialize value into xml: " + o) - - -def _get_wrapped_element( - v: typing.Any, - exclude_readonly: bool, - meta: typing.Optional[dict[str, typing.Any]], -) -> ET.Element: - _meta_ns = _get_xml_ns(meta) if meta else None - wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns - ) - if isinstance(v, (dict, list)): - wrapped_element.extend(_get_element(v, exclude_readonly, meta)) - elif _is_model(v): - _get_element(v, exclude_readonly, meta, wrapped_element) - else: - wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element # type: ignore[no-any-return] - - -def _get_primitive_type_value(v) -> str: - if v is True: - return "true" - if v is False: - return "false" - if isinstance(v, _Null): - return "" - return str(v) - - -def _safe_register_namespace(prefix: str, ns: str) -> None: - """Register an XML namespace prefix, handling reserved prefix patterns. - - Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for - auto-generated prefixes, causing register_namespace to raise ValueError. - Falls back to directly registering in the internal namespace map. - - :param str prefix: The namespace prefix to register. - :param str ns: The namespace URI. - """ - try: - ET.register_namespace(prefix, ns) - except ValueError: - _ns_map = getattr(ET, "_namespace_map", None) - if _ns_map is not None: - _ns_map[ns] = prefix - - -def _create_xml_element( - tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None -) -> ET.Element: - if prefix and ns: - _safe_register_namespace(prefix, ns) - if ns: - return ET.Element("{" + ns + "}" + tag) - return ET.Element(tag) - - -def _deserialize_xml( - deserializer: typing.Any, - value: str, -) -> typing.Any: - element = ET.fromstring(value) # nosec - if _is_model(deserializer): - return deserializer._deserialize(element, []) - return _deserialize(deserializer, element) - - -def _convert_element(e: ET.Element): - # dict case - if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: dict[str, typing.Any] = {} - for child in e: - if dict_result.get(child.tag) is not None: - if isinstance(dict_result[child.tag], list): - dict_result[child.tag].append(_convert_element(child)) - else: - dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] - else: - dict_result[child.tag] = _convert_element(child) - dict_result.update(e.attrib) - return dict_result - # array case - if len(e) > 0: - array_result: list[typing.Any] = [] - for child in e: - array_result.append(_convert_element(child)) - return array_result - # primitive case - return e.text diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/serialization.py deleted file mode 100644 index a088671e9c51..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/serialization.py +++ /dev/null @@ -1,2066 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # Fast path for header deserialization: response_data is a plain str or None - # and target_obj is a simple scalar type. This avoids the expensive - # _unpack_content → _deserialize → _classify_target → deserialize_data chain. - if response_data is None: - return None - if target_obj == "str" and isinstance(response_data, str): - return response_data - if isinstance(response_data, str): - if target_obj == "int": - return int(response_data) - if target_obj == "bool": - if response_data in ("true", "1", "True"): - return True - if response_data in ("false", "0", "False"): - return False - return bool(response_data) - if target_obj == "rfc-1123": - return Deserializer.deserialize_rfc(response_data) - if target_obj == "bytearray": - return Deserializer.deserialize_bytearray(response_data) - - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/utils.py deleted file mode 100644 index 35c9c836f85f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_version.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_version.py deleted file mode 100644 index be71c81bd282..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b1" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/__init__.py deleted file mode 100644 index 09d460087974..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import SingleDiscriminatorClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SingleDiscriminatorClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_client.py deleted file mode 100644 index 99db70d4bb7a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_client.py +++ /dev/null @@ -1,101 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -import sys -from typing import Any, Awaitable - -from azure.core import AsyncPipelineClient -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .._utils.serialization import Deserializer, Serializer -from ._configuration import SingleDiscriminatorClientConfiguration -from ._operations import _SingleDiscriminatorClientOperationsMixin - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class SingleDiscriminatorClient( - _SingleDiscriminatorClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """Illustrates inheritance with single discriminator. - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = SingleDiscriminatorClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_configuration.py deleted file mode 100644 index 848667af9cc6..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from .._version import VERSION - - -class SingleDiscriminatorClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for SingleDiscriminatorClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-singlediscriminator-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/__init__.py deleted file mode 100644 index 0d3d6a1e224d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _SingleDiscriminatorClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_operations.py deleted file mode 100644 index 52061f94dec2..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_operations.py +++ /dev/null @@ -1,539 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import models as _models, types -from ..._operations._operations import ( - build_single_discriminator_get_legacy_model_request, - build_single_discriminator_get_missing_discriminator_request, - build_single_discriminator_get_model_request, - build_single_discriminator_get_recursive_model_request, - build_single_discriminator_get_wrong_discriminator_request, - build_single_discriminator_put_model_request, - build_single_discriminator_put_recursive_model_request, -) -from ..._utils.model_base import SdkJSONEncoder, _deserialize -from ..._utils.utils import ClientMixinABC -from .._configuration import SingleDiscriminatorClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _SingleDiscriminatorClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], SingleDiscriminatorClientConfiguration] -): - - @distributed_trace_async - async def get_model(self, **kwargs: Any) -> _models.Bird: - """get_model. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put_model(self, input: _models.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_model(self, input: types.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.types.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_model(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_model(self, input: Union[_models.Bird, types.Bird, IO[bytes]], **kwargs: Any) -> None: - """put_model. - - :param input: Is either a Bird type or a IO[bytes] type. Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird or - ~typetest.model.singlediscriminator.typeddict.types.Bird or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_single_discriminator_put_model_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_recursive_model(self, **kwargs: Any) -> _models.Bird: - """get_recursive_model. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_recursive_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put_recursive_model( - self, input: _models.Bird, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_recursive_model( - self, input: types.Bird, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.types.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_recursive_model( - self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_recursive_model(self, input: Union[_models.Bird, types.Bird, IO[bytes]], **kwargs: Any) -> None: - """put_recursive_model. - - :param input: Is either a Bird type or a IO[bytes] type. Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird or - ~typetest.model.singlediscriminator.typeddict.types.Bird or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_single_discriminator_put_recursive_model_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_missing_discriminator(self, **kwargs: Any) -> _models.Bird: - """get_missing_discriminator. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_missing_discriminator_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_wrong_discriminator(self, **kwargs: Any) -> _models.Bird: - """get_wrong_discriminator. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_wrong_discriminator_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_legacy_model(self, **kwargs: Any) -> _models.Dinosaur: - """get_legacy_model. - - :return: Dinosaur. The Dinosaur is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Dinosaur - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Dinosaur] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_legacy_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Dinosaur, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/__init__.py deleted file mode 100644 index b19768d50489..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models import ( # type: ignore - Bird, - Dinosaur, - Eagle, - Goose, - SeaGull, - Sparrow, - TRex, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Bird", - "Dinosaur", - "Eagle", - "Goose", - "SeaGull", - "Sparrow", - "TRex", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_models.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_models.py deleted file mode 100644 index a913719f17d3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_models.py +++ /dev/null @@ -1,259 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 - -from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, overload - -from .._utils.model_base import Model as _Model, rest_discriminator, rest_field - -if TYPE_CHECKING: - from .. import models as _models - - -class Bird(_Model): - """This is base model for polymorphic single level inheritance with a discriminator. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - Eagle, Goose, SeaGull, Sparrow - - :ivar kind: Required. Default value is None. - :vartype kind: str - :ivar wingspan: Required. - :vartype wingspan: int - """ - - __mapping__: dict[str, _Model] = {} - kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """Required. Default value is None.""" - wingspan: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - kind: str, - wingspan: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Dinosaur(_Model): - """Define a base class in the legacy way. Discriminator property is not explicitly defined in the - model. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - TRex - - :ivar kind: Discriminator property for Dinosaur. Required. Default value is None. - :vartype kind: str - :ivar size: Required. - :vartype size: int - """ - - __mapping__: dict[str, _Model] = {} - kind: str = rest_discriminator(name="kind") - """Discriminator property for Dinosaur. Required. Default value is None.""" - size: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - kind: str, - size: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Eagle(Bird, discriminator="eagle"): - """The second level model in polymorphic single levels inheritance which contains references to - other polymorphic instances. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "eagle". - :vartype kind: str - :ivar friends: - :vartype friends: list[~typetest.model.singlediscriminator.typeddict.models.Bird] - :ivar hate: - :vartype hate: dict[str, ~typetest.model.singlediscriminator.typeddict.models.Bird] - :ivar partner: - :vartype partner: ~typetest.model.singlediscriminator.typeddict.models.Bird - """ - - kind: Literal["eagle"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"eagle\".""" - friends: Optional[list["_models.Bird"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - hate: Optional[dict[str, "_models.Bird"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - partner: Optional["_models.Bird"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - - @overload - def __init__( - self, - *, - wingspan: int, - friends: Optional[list["_models.Bird"]] = None, - hate: Optional[dict[str, "_models.Bird"]] = None, - partner: Optional["_models.Bird"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "eagle" # type: ignore - - -class Goose(Bird, discriminator="goose"): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "goose". - :vartype kind: str - """ - - kind: Literal["goose"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"goose\".""" - - @overload - def __init__( - self, - *, - wingspan: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "goose" # type: ignore - - -class SeaGull(Bird, discriminator="seagull"): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "seagull". - :vartype kind: str - """ - - kind: Literal["seagull"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"seagull\".""" - - @overload - def __init__( - self, - *, - wingspan: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "seagull" # type: ignore - - -class Sparrow(Bird, discriminator="sparrow"): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "sparrow". - :vartype kind: str - """ - - kind: Literal["sparrow"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"sparrow\".""" - - @overload - def __init__( - self, - *, - wingspan: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "sparrow" # type: ignore - - -class TRex(Dinosaur, discriminator="t-rex"): - """The second level legacy model in polymorphic single level inheritance. - - :ivar size: Required. - :vartype size: int - :ivar kind: Required. Default value is "t-rex". - :vartype kind: str - """ - - kind: Literal["t-rex"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"t-rex\".""" - - @overload - def __init__( - self, - *, - size: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "t-rex" # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/py.typed b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/types.py deleted file mode 100644 index 22565fd954d4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/types.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class Eagle(TypedDict, total=False): - """The second level model in polymorphic single levels inheritance which contains references to - other polymorphic instances. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "eagle". - :vartype kind: str - :ivar friends: - :vartype friends: list[~typetest.model.singlediscriminator.typeddict.models.Bird] - :ivar hate: - :vartype hate: dict[str, ~typetest.model.singlediscriminator.typeddict.models.Bird] - :ivar partner: - :vartype partner: ~typetest.model.singlediscriminator.typeddict.models.Bird - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["eagle"]] - """Required. Default value is \"eagle\".""" - friends: list["Bird"] - hate: dict[str, "Bird"] - partner: "Bird" - - -class Goose(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "goose". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["goose"]] - """Required. Default value is \"goose\".""" - - -class SeaGull(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "seagull". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["seagull"]] - """Required. Default value is \"seagull\".""" - - -class Sparrow(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "sparrow". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["sparrow"]] - """Required. Default value is \"sparrow\".""" - - -class TRex(TypedDict, total=False): - """The second level legacy model in polymorphic single level inheritance. - - :ivar size: Required. - :vartype size: int - :ivar kind: Required. Default value is "t-rex". - :vartype kind: str - """ - - size: Required[int] - """Required.""" - kind: Required[Literal["t-rex"]] - """Required. Default value is \"t-rex\".""" - - -Bird = Union[Eagle, Goose, SeaGull, Sparrow] -Dinosaur = Union[TRex] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/types.py deleted file mode 100644 index 50051cb83259..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/types.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class Eagle(TypedDict, total=False): - """The second level model in polymorphic single levels inheritance which contains references to - other polymorphic instances. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "eagle". - :vartype kind: str - :ivar friends: - :vartype friends: list[~typetest.model.singlediscriminator.models.Bird] - :ivar hate: - :vartype hate: dict[str, ~typetest.model.singlediscriminator.models.Bird] - :ivar partner: - :vartype partner: ~typetest.model.singlediscriminator.models.Bird - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["eagle"]] - """Required. Default value is \"eagle\".""" - friends: list["Bird"] - hate: dict[str, "Bird"] - partner: "Bird" - - -class Goose(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "goose". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["goose"]] - """Required. Default value is \"goose\".""" - - -class SeaGull(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "seagull". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["seagull"]] - """Required. Default value is \"seagull\".""" - - -class Sparrow(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "sparrow". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["sparrow"]] - """Required. Default value is \"sparrow\".""" - - -class TRex(TypedDict, total=False): - """The second level legacy model in polymorphic single level inheritance. - - :ivar size: Required. - :vartype size: int - :ivar kind: Required. Default value is "t-rex". - :vartype kind: str - """ - - size: Required[int] - """Required.""" - kind: Required[Literal["t-rex"]] - """Required. Default value is \"t-rex\".""" - - -Bird = Union[Eagle, Goose, SeaGull, Sparrow] -Dinosaur = Union[TRex] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/CHANGELOG.md deleted file mode 100644 index b957b2575b48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release History - -## 1.0.0b1 (1970-01-01) - -### Other Changes - - - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/LICENSE b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/LICENSE deleted file mode 100644 index 63447fd8bbbf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/MANIFEST.in b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/MANIFEST.in deleted file mode 100644 index 77f246974077..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include *.md -include LICENSE -include typetest/model/usage/typeddictonly/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include typetest/__init__.py -include typetest/model/__init__.py -include typetest/model/usage/__init__.py diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/_metadata.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/_metadata.json deleted file mode 100644 index 49515fdbafdf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/_metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "apiVersions": {} -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/apiview-properties.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/apiview-properties.json deleted file mode 100644 index 4f0f9ccb9a5b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/apiview-properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Usage", - "CrossLanguageDefinitionId": { - "typetest.model.usage.typeddictonly.UsageClient.input": "Type.Model.Usage.input", - "typetest.model.usage.typeddictonly.aio.UsageClient.input": "Type.Model.Usage.input", - "typetest.model.usage.typeddictonly.UsageClient.output": "Type.Model.Usage.output", - "typetest.model.usage.typeddictonly.aio.UsageClient.output": "Type.Model.Usage.output", - "typetest.model.usage.typeddictonly.UsageClient.input_and_output": "Type.Model.Usage.inputAndOutput", - "typetest.model.usage.typeddictonly.aio.UsageClient.input_and_output": "Type.Model.Usage.inputAndOutput" - }, - "CrossLanguageVersion": "f962027db695" -} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/dev_requirements.txt b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/dev_requirements.txt deleted file mode 100644 index 0e53b6a72db5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/dev_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --e ../../../eng/tools/azure-sdk-tools -../../core/azure-core -aiohttp \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/conftest.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/conftest.py deleted file mode 100644 index 6a990b92bd70..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/conftest.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import os -import pytest -from dotenv import load_dotenv -from devtools_testutils import ( - test_proxy, - add_general_regex_sanitizer, - add_body_key_sanitizer, - add_header_regex_sanitizer, -) - -load_dotenv() - - -# For security, please avoid record sensitive identity information in recordings -@pytest.fixture(scope="session", autouse=True) -def add_sanitizers(test_proxy): - usage_subscription_id = os.environ.get("USAGE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - usage_tenant_id = os.environ.get("USAGE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - usage_client_id = os.environ.get("USAGE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - usage_client_secret = os.environ.get("USAGE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=usage_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=usage_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=usage_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=usage_client_secret, value="00000000-0000-0000-0000-000000000000") - - add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") - add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/test_usage.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/test_usage.py deleted file mode 100644 index 7514cae181d8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/test_usage.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import UsageClientTestBase, UsagePreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestUsage(UsageClientTestBase): - @UsagePreparer() - @recorded_by_proxy - def test_input(self, usage_endpoint): - client = self.create_client(endpoint=usage_endpoint) - response = client.input( - input={"requiredProp": "str"}, - ) - - # please add some check logic here by yourself - # ... - - @UsagePreparer() - @recorded_by_proxy - def test_output(self, usage_endpoint): - client = self.create_client(endpoint=usage_endpoint) - response = client.output() - - # please add some check logic here by yourself - # ... - - @UsagePreparer() - @recorded_by_proxy - def test_input_and_output(self, usage_endpoint): - client = self.create_client(endpoint=usage_endpoint) - response = client.input_and_output( - body={"requiredProp": "str"}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/test_usage_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/test_usage_async.py deleted file mode 100644 index c2a66f7642ba..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/test_usage_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import UsagePreparer -from testpreparer_async import UsageClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestUsageAsync(UsageClientTestBaseAsync): - @UsagePreparer() - @recorded_by_proxy_async - async def test_input(self, usage_endpoint): - client = self.create_async_client(endpoint=usage_endpoint) - response = await client.input( - input={"requiredProp": "str"}, - ) - - # please add some check logic here by yourself - # ... - - @UsagePreparer() - @recorded_by_proxy_async - async def test_output(self, usage_endpoint): - client = self.create_async_client(endpoint=usage_endpoint) - response = await client.output() - - # please add some check logic here by yourself - # ... - - @UsagePreparer() - @recorded_by_proxy_async - async def test_input_and_output(self, usage_endpoint): - client = self.create_async_client(endpoint=usage_endpoint) - response = await client.input_and_output( - body={"requiredProp": "str"}, - ) - - # please add some check logic here by yourself - # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/testpreparer.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/testpreparer.py deleted file mode 100644 index 9697b5588a98..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/testpreparer.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer -import functools -from typetest.model.usage.typeddictonly import UsageClient - - -class UsageClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(UsageClient) - return self.create_client_from_credential( - UsageClient, - credential=credential, - endpoint=endpoint, - ) - - -UsagePreparer = functools.partial(PowerShellPreparer, "usage", usage_endpoint="https://fake_usage_endpoint.com") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/testpreparer_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/testpreparer_async.py deleted file mode 100644 index 8d902bf10492..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/generated_tests/testpreparer_async.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from devtools_testutils import AzureRecordedTestCase -from typetest.model.usage.typeddictonly.aio import UsageClient - - -class UsageClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(UsageClient, is_async=True) - return self.create_client_from_credential( - UsageClient, - credential=credential, - endpoint=endpoint, - ) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/pyproject.toml b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/pyproject.toml deleted file mode 100644 index ed6ec01a4baf..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/pyproject.toml +++ /dev/null @@ -1,61 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -[build-system] -requires = ["setuptools>=77.0.3", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "typetest-model-usage-typeddictonly" -authors = [ - { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, -] -description = "Microsoft Corporation Azure Typetest Model Usage Typeddictonly Client Library for Python" -license = "MIT" -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", -] -requires-python = ">=3.10" -keywords = ["azure", "azure sdk"] - -dependencies = [ - "isodate>=0.6.1", - "azure-core>=1.37.0", - "typing-extensions>=4.6.0", -] -dynamic = [ -"version", "readme" -] - -[project.urls] -repository = "https://github.com/Azure/azure-sdk-for-python" - -[tool.setuptools.dynamic] -version = {attr = "typetest.model.usage.typeddictonly._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} - -[tool.setuptools.packages.find] -exclude = [ - "tests*", - "generated_tests*", - "samples*", - "generated_samples*", - "doc*", - "typetest", - "typetest.model", - "typetest.model.usage", -] - -[tool.setuptools.package-data] -pytyped = ["py.typed"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/__init__.py deleted file mode 100644 index 50d20a1b2af4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import UsageClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "UsageClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_client.py deleted file mode 100644 index 0c89427f010b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_client.py +++ /dev/null @@ -1,97 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -import sys -from typing import Any - -from azure.core import PipelineClient -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse - -from ._configuration import UsageClientConfiguration -from ._operations import _UsageClientOperationsMixin -from ._utils.serialization import Deserializer, Serializer - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Illustrates usage of Record in different places(Operation parameters, return type or both). - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = UsageClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_configuration.py deleted file mode 100644 index c46c2bb4f5d5..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from ._version import VERSION - - -class UsageClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for UsageClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-usage-typeddictonly/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/__init__.py deleted file mode 100644 index 7a7c3e9596c7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _UsageClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_operations.py deleted file mode 100644 index 3f1cdc0db660..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_operations.py +++ /dev/null @@ -1,399 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import types -from .._configuration import UsageClientConfiguration -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_usage_input_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/type/model/usage/input" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_usage_output_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/usage/output" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_usage_input_and_output_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/usage/input-output" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -class _UsageClientOperationsMixin(ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], UsageClientConfiguration]): - - @overload - def input(self, input: types.InputRecord, *, content_type: str = "application/json", **kwargs: Any) -> None: - """input. - - :param input: Required. - :type input: ~typetest.model.usage.typeddictonly.types.InputRecord - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - input = { - "requiredProp": "str" - } - """ - - @overload - def input(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """input. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def input( # pylint: disable=inconsistent-return-statements - self, input: Union[types.InputRecord, IO[bytes]], **kwargs: Any - ) -> None: - """input. - - :param input: Is either a InputRecord type or a IO[bytes] type. Required. - :type input: ~typetest.model.usage.typeddictonly.types.InputRecord or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - input = { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _json = input - - _request = build_usage_input_request( - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def output(self, **kwargs: Any) -> types.OutputRecord: - """output. - - :return: OutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.OutputRecord - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[types.OutputRecord] = kwargs.pop("cls", None) - - _request = build_usage_output_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def input_and_output( - self, body: types.InputOutputRecord, *, content_type: str = "application/json", **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Required. - :type body: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "requiredProp": "str" - } - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - - @overload - def input_and_output( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - - @distributed_trace - def input_and_output( - self, body: Union[types.InputOutputRecord, IO[bytes]], **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Is either a InputOutputRecord type or a IO[bytes] type. Required. - :type body: ~typetest.model.usage.typeddictonly.types.InputOutputRecord or IO[bytes] - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "requiredProp": "str" - } - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[types.InputOutputRecord] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = body - - _request = build_usage_input_and_output_request( - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/__init__.py deleted file mode 100644 index 8026245c2abc..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/serialization.py deleted file mode 100644 index a088671e9c51..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/serialization.py +++ /dev/null @@ -1,2066 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # Fast path for header deserialization: response_data is a plain str or None - # and target_obj is a simple scalar type. This avoids the expensive - # _unpack_content → _deserialize → _classify_target → deserialize_data chain. - if response_data is None: - return None - if target_obj == "str" and isinstance(response_data, str): - return response_data - if isinstance(response_data, str): - if target_obj == "int": - return int(response_data) - if target_obj == "bool": - if response_data in ("true", "1", "True"): - return True - if response_data in ("false", "0", "False"): - return False - return bool(response_data) - if target_obj == "rfc-1123": - return Deserializer.deserialize_rfc(response_data) - if target_obj == "bytearray": - return Deserializer.deserialize_bytearray(response_data) - - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/utils.py deleted file mode 100644 index 35c9c836f85f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_version.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_version.py deleted file mode 100644 index be71c81bd282..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "1.0.0b1" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/__init__.py deleted file mode 100644 index d861130d94bb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import UsageClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "UsageClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_client.py deleted file mode 100644 index c0c86a1c19ee..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_client.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -import sys -from typing import Any, Awaitable - -from azure.core import AsyncPipelineClient -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .._utils.serialization import Deserializer, Serializer -from ._configuration import UsageClientConfiguration -from ._operations import _UsageClientOperationsMixin - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Illustrates usage of Record in different places(Operation parameters, return type or both). - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = UsageClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_configuration.py deleted file mode 100644 index fbd2e5d4a0d6..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.pipeline import policies - -from .._version import VERSION - - -class UsageClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for UsageClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-usage-typeddictonly/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/__init__.py deleted file mode 100644 index 7a7c3e9596c7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _UsageClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_operations.py deleted file mode 100644 index 2a6c727ec8ba..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_operations.py +++ /dev/null @@ -1,356 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import types -from ..._operations._operations import ( - build_usage_input_and_output_request, - build_usage_input_request, - build_usage_output_request, -) -from ..._utils.utils import ClientMixinABC -from .._configuration import UsageClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _UsageClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], UsageClientConfiguration] -): - - @overload - async def input(self, input: types.InputRecord, *, content_type: str = "application/json", **kwargs: Any) -> None: - """input. - - :param input: Required. - :type input: ~typetest.model.usage.typeddictonly.types.InputRecord - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - input = { - "requiredProp": "str" - } - """ - - @overload - async def input(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """input. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def input(self, input: Union[types.InputRecord, IO[bytes]], **kwargs: Any) -> None: - """input. - - :param input: Is either a InputRecord type or a IO[bytes] type. Required. - :type input: ~typetest.model.usage.typeddictonly.types.InputRecord or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - input = { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _json = input - - _request = build_usage_input_request( - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def output(self, **kwargs: Any) -> types.OutputRecord: - """output. - - :return: OutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.OutputRecord - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[types.OutputRecord] = kwargs.pop("cls", None) - - _request = build_usage_output_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def input_and_output( - self, body: types.InputOutputRecord, *, content_type: str = "application/json", **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Required. - :type body: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "requiredProp": "str" - } - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - - @overload - async def input_and_output( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - - @distributed_trace_async - async def input_and_output( - self, body: Union[types.InputOutputRecord, IO[bytes]], **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Is either a InputOutputRecord type or a IO[bytes] type. Required. - :type body: ~typetest.model.usage.typeddictonly.types.InputOutputRecord or IO[bytes] - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "requiredProp": "str" - } - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[types.InputOutputRecord] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = body - - _request = build_usage_input_and_output_request( - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/__init__.py deleted file mode 100644 index e3b4c5295f07..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# 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 typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/py.typed b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/types.py deleted file mode 100644 index 137fc8828b86..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/types.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class InputOutputRecord(TypedDict, total=False): - """Record used both as operation parameter and return type. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" - - -class InputRecord(TypedDict, total=False): - """Record used in operation parameters. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" - - -class OutputRecord(TypedDict, total=False): - """Record used in operation return type. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/types.py deleted file mode 100644 index 137fc8828b86..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-usage/typetest/model/usage/types.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class InputOutputRecord(TypedDict, total=False): - """Record used both as operation parameter and return type. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" - - -class InputRecord(TypedDict, total=False): - """Record used in operation parameters. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" - - -class OutputRecord(TypedDict, total=False): - """Record used in operation return type. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/types.py deleted file mode 100644 index 067d1a22265f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-model-visibility/typetest/model/visibility/types.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Optional -from typing_extensions import Required, TypedDict - - -class ReadOnlyModel(TypedDict, total=False): - """RoundTrip model with readonly optional properties. - - :ivar optional_nullable_int_list: Optional readonly nullable int list. - :vartype optional_nullable_int_list: list[int] - :ivar optional_string_record: Optional readonly string dictionary. - :vartype optional_string_record: dict[str, str] - """ - - optionalNullableIntList: Optional[list[int]] - """Optional readonly nullable int list.""" - optionalStringRecord: dict[str, str] - """Optional readonly string dictionary.""" - - -class VisibilityModel(TypedDict, total=False): - """Output model with visibility properties. - - :ivar read_prop: Required string, illustrating a readonly property. Required. - :vartype read_prop: str - :ivar create_prop: Required string[], illustrating a create property. Required. - :vartype create_prop: list[str] - :ivar update_prop: Required int32[], illustrating a update property. Required. - :vartype update_prop: list[int] - :ivar delete_prop: Required bool, illustrating a delete property. Required. - :vartype delete_prop: bool - """ - - readProp: Required[str] - """Required string, illustrating a readonly property. Required.""" - createProp: Required[list[str]] - """Required string[], illustrating a create property. Required.""" - updateProp: Required[list[int]] - """Required int32[], illustrating a update property. Required.""" - deleteProp: Required[bool] - """Required bool, illustrating a delete property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/types.py deleted file mode 100644 index 94285bc5681f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/types.py +++ /dev/null @@ -1,463 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class DifferentSpreadFloatRecord(TypedDict, total=False): - """The model spread Record with the different known property type. - - :ivar name: The id property. Required. - :vartype name: str - """ - - name: Required[str] - """The id property. Required.""" - - -class DifferentSpreadFloatDerived(DifferentSpreadFloatRecord): - """The model extends from a model that spread Record with the different known property - type. - - :ivar name: The id property. Required. - :vartype name: str - :ivar derived_prop: The index property. Required. - :vartype derived_prop: float - """ - - derivedProp: Required[float] - """The index property. Required.""" - - -class DifferentSpreadModelArrayRecord(TypedDict, total=False): - """The model spread Record with the different known property type. - - :ivar known_prop: Required. - :vartype known_prop: str - """ - - knownProp: Required[str] - """Required.""" - - -class DifferentSpreadModelArrayDerived(DifferentSpreadModelArrayRecord): - """The model extends from a model that spread Record with the different known - property type. - - :ivar known_prop: Required. - :vartype known_prop: str - :ivar derived_prop: The index property. Required. - :vartype derived_prop: list[~typetest.property.additionalproperties.models.ModelForRecord] - """ - - derivedProp: Required[list["ModelForRecord"]] - """The index property. Required.""" - - -class DifferentSpreadModelRecord(TypedDict, total=False): - """The model spread Record with the different known property type. - - :ivar known_prop: Required. - :vartype known_prop: str - """ - - knownProp: Required[str] - """Required.""" - - -class DifferentSpreadModelDerived(DifferentSpreadModelRecord): - """The model extends from a model that spread Record with the different known - property type. - - :ivar known_prop: Required. - :vartype known_prop: str - :ivar derived_prop: The index property. Required. - :vartype derived_prop: ~typetest.property.additionalproperties.models.ModelForRecord - """ - - derivedProp: Required["ModelForRecord"] - """The index property. Required.""" - - -class DifferentSpreadStringRecord(TypedDict, total=False): - """The model spread Record with the different known property type. - - :ivar id: The name property. Required. - :vartype id: float - """ - - id: Required[float] - """The name property. Required.""" - - -class DifferentSpreadStringDerived(DifferentSpreadStringRecord): - """The model extends from a model that spread Record with the different known property - type. - - :ivar id: The name property. Required. - :vartype id: float - :ivar derived_prop: The index property. Required. - :vartype derived_prop: str - """ - - derivedProp: Required[str] - """The index property. Required.""" - - -class ExtendsFloatAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar id: The id property. Required. - :vartype id: float - """ - - id: Required[float] - """The id property. Required.""" - - -class ExtendsModelAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar known_prop: Required. - :vartype known_prop: ~typetest.property.additionalproperties.models.ModelForRecord - """ - - knownProp: Required["ModelForRecord"] - """Required.""" - - -class ExtendsModelArrayAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar known_prop: Required. - :vartype known_prop: list[~typetest.property.additionalproperties.models.ModelForRecord] - """ - - knownProp: Required[list["ModelForRecord"]] - """Required.""" - - -class ExtendsStringAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class ExtendsUnknownAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class ExtendsUnknownAdditionalPropertiesDerived(ExtendsUnknownAdditionalProperties): # pylint: disable=name-too-long - """The model extends from a type that extends from Record. - - :ivar name: The name property. Required. - :vartype name: str - :ivar index: The index property. Required. - :vartype index: int - :ivar age: The age property. - :vartype age: float - """ - - index: Required[int] - """The index property. Required.""" - age: float - """The age property.""" - - -class ExtendsUnknownAdditionalPropertiesDiscriminatedDerived(TypedDict, total=False): # pylint: disable=name-too-long - """The derived discriminated type. - - :ivar name: The name property. Required. - :vartype name: str - :ivar kind: Required. Default value is "derived". - :vartype kind: str - :ivar index: The index property. Required. - :vartype index: int - :ivar age: The age property. - :vartype age: float - """ - - name: Required[str] - """The name property. Required.""" - kind: Required[Literal["derived"]] - """Required. Default value is \"derived\".""" - index: Required[int] - """The index property. Required.""" - age: float - """The age property.""" - - -class IsFloatAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar id: The id property. Required. - :vartype id: float - """ - - id: Required[float] - """The id property. Required.""" - - -class IsModelAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar known_prop: Required. - :vartype known_prop: ~typetest.property.additionalproperties.models.ModelForRecord - """ - - knownProp: Required["ModelForRecord"] - """Required.""" - - -class IsModelArrayAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar known_prop: Required. - :vartype known_prop: list[~typetest.property.additionalproperties.models.ModelForRecord] - """ - - knownProp: Required[list["ModelForRecord"]] - """Required.""" - - -class IsStringAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class IsUnknownAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class IsUnknownAdditionalPropertiesDerived(IsUnknownAdditionalProperties): - """The model extends from a type that is Record type. - - :ivar name: The name property. Required. - :vartype name: str - :ivar index: The index property. Required. - :vartype index: int - :ivar age: The age property. - :vartype age: float - """ - - index: Required[int] - """The index property. Required.""" - age: float - """The age property.""" - - -class IsUnknownAdditionalPropertiesDiscriminatedDerived(TypedDict, total=False): # pylint: disable=name-too-long - """The derived discriminated type. - - :ivar name: The name property. Required. - :vartype name: str - :ivar kind: Required. Default value is "derived". - :vartype kind: str - :ivar index: The index property. Required. - :vartype index: int - :ivar age: The age property. - :vartype age: float - """ - - name: Required[str] - """The name property. Required.""" - kind: Required[Literal["derived"]] - """Required. Default value is \"derived\".""" - index: Required[int] - """The index property. Required.""" - age: float - """The age property.""" - - -class ModelForRecord(TypedDict, total=False): - """model for record. - - :ivar state: The state property. Required. - :vartype state: str - """ - - state: Required[str] - """The state property. Required.""" - - -class MultipleSpreadRecord(TypedDict, total=False): - """The model spread Record and Record. - - :ivar flag: The name property. Required. - :vartype flag: bool - """ - - flag: Required[bool] - """The name property. Required.""" - - -class SpreadFloatRecord(TypedDict, total=False): - """The model spread Record with the same known property type. - - :ivar id: The id property. Required. - :vartype id: float - """ - - id: Required[float] - """The id property. Required.""" - - -class SpreadModelArrayRecord(TypedDict, total=False): - """SpreadModelArrayRecord. - - :ivar known_prop: Required. - :vartype known_prop: list[~typetest.property.additionalproperties.models.ModelForRecord] - """ - - knownProp: Required[list["ModelForRecord"]] - """Required.""" - - -class SpreadModelRecord(TypedDict, total=False): - """The model spread Record with the same known property type. - - :ivar known_prop: Required. - :vartype known_prop: ~typetest.property.additionalproperties.models.ModelForRecord - """ - - knownProp: Required["ModelForRecord"] - """Required.""" - - -class SpreadRecordForNonDiscriminatedUnion(TypedDict, total=False): - """The model spread Record. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class SpreadRecordForNonDiscriminatedUnion2(TypedDict, total=False): - """The model spread Record. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class SpreadRecordForNonDiscriminatedUnion3(TypedDict, total=False): - """The model spread Record. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class SpreadRecordForUnion(TypedDict, total=False): - """The model spread Record. - - :ivar flag: The name property. Required. - :vartype flag: bool - """ - - flag: Required[bool] - """The name property. Required.""" - - -class SpreadStringRecord(TypedDict, total=False): - """The model spread Record with the same known property type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class WidgetData0(TypedDict, total=False): - """WidgetData0. - - :ivar kind: Required. Default value is "kind0". - :vartype kind: str - :ivar foo_prop: Required. - :vartype foo_prop: str - """ - - kind: Required[Literal["kind0"]] - """Required. Default value is \"kind0\".""" - fooProp: Required[str] - """Required.""" - - -class WidgetData1(TypedDict, total=False): - """WidgetData1. - - :ivar kind: Required. Default value is "kind1". - :vartype kind: str - :ivar start: Required. - :vartype start: ~datetime.datetime - :ivar end: - :vartype end: ~datetime.datetime - """ - - kind: Required[Literal["kind1"]] - """Required. Default value is \"kind1\".""" - start: Required[datetime.datetime] - """Required.""" - end: datetime.datetime - - -class WidgetData2(TypedDict, total=False): - """WidgetData2. - - :ivar kind: Required. Default value is "kind1". - :vartype kind: str - :ivar start: Required. - :vartype start: str - """ - - kind: Required[Literal["kind1"]] - """Required. Default value is \"kind1\".""" - start: Required[str] - """Required.""" - - -ExtendsUnknownAdditionalPropertiesDiscriminated = Union[ExtendsUnknownAdditionalPropertiesDiscriminatedDerived] -IsUnknownAdditionalPropertiesDiscriminated = Union[IsUnknownAdditionalPropertiesDiscriminatedDerived] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/types.py deleted file mode 100644 index 1dc2c39c037a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-nullable/typetest/property/nullable/types.py +++ /dev/null @@ -1,129 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Optional -from typing_extensions import Required, TypedDict - - -class BytesProperty(TypedDict, total=False): - """Template type for testing models with nullable property. Pass in the type of the property you - are looking for. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: bytes - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[bytes]] - """Property. Required.""" - - -class CollectionsByteProperty(TypedDict, total=False): - """Model with collection bytes properties. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: list[bytes] - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[list[bytes]]] - """Property. Required.""" - - -class CollectionsModelProperty(TypedDict, total=False): - """Model with collection models properties. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: list[~typetest.property.nullable.models.InnerModel] - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[list["InnerModel"]]] - """Property. Required.""" - - -class CollectionsStringProperty(TypedDict, total=False): - """Model with collection string properties. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: list[str] - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[list[str]]] - """Property. Required.""" - - -class DatetimeProperty(TypedDict, total=False): - """Model with a datetime property. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: ~datetime.datetime - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[datetime.datetime]] - """Property. Required.""" - - -class DurationProperty(TypedDict, total=False): - """Model with a duration property. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: ~datetime.timedelta - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[datetime.timedelta]] - """Property. Required.""" - - -class InnerModel(TypedDict, total=False): - """Inner model used in collections model property. - - :ivar property: Inner model property. Required. - :vartype property: str - """ - - property: Required[str] - """Inner model property. Required.""" - - -class StringProperty(TypedDict, total=False): - """Template type for testing models with nullable property. Pass in the type of the property you - are looking for. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: str - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[str]] - """Property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/types.py deleted file mode 100644 index fa53cab3de11..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-optional/typetest/property/optional/types.py +++ /dev/null @@ -1,193 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Literal -from typing_extensions import Required, TypedDict - - -class BooleanLiteralProperty(TypedDict, total=False): - """Model with boolean literal property. - - :ivar property: Property. Default value is True. - :vartype property: bool - """ - - property: Literal[True] - """Property. Default value is True.""" - - -class BytesProperty(TypedDict, total=False): - """Template type for testing models with optional property. Pass in the type of the property you - are looking for. - - :ivar property: Property. - :vartype property: bytes - """ - - property: bytes - """Property.""" - - -class CollectionsByteProperty(TypedDict, total=False): - """Model with collection bytes properties. - - :ivar property: Property. - :vartype property: list[bytes] - """ - - property: list[bytes] - """Property.""" - - -class CollectionsModelProperty(TypedDict, total=False): - """Model with collection models properties. - - :ivar property: Property. - :vartype property: list[~typetest.property.optional.models.StringProperty] - """ - - property: list["StringProperty"] - """Property.""" - - -class DatetimeProperty(TypedDict, total=False): - """Model with a datetime property. - - :ivar property: Property. - :vartype property: ~datetime.datetime - """ - - property: datetime.datetime - """Property.""" - - -class DurationProperty(TypedDict, total=False): - """Model with a duration property. - - :ivar property: Property. - :vartype property: ~datetime.timedelta - """ - - property: datetime.timedelta - """Property.""" - - -class FloatLiteralProperty(TypedDict, total=False): - """Model with float literal property. - - :ivar property: Property. Default value is 1.25. - :vartype property: float - """ - - property: float - """Property. Default value is 1.25.""" - - -class IntLiteralProperty(TypedDict, total=False): - """Model with int literal property. - - :ivar property: Property. Default value is 1. - :vartype property: int - """ - - property: Literal[1] - """Property. Default value is 1.""" - - -class PlainDateProperty(TypedDict, total=False): - """Model with a plainDate property. - - :ivar property: Property. - :vartype property: ~datetime.date - """ - - property: datetime.date - """Property.""" - - -class PlainTimeProperty(TypedDict, total=False): - """Model with a plainTime property. - - :ivar property: Property. - :vartype property: ~datetime.time - """ - - property: datetime.time - """Property.""" - - -class RequiredAndOptionalProperty(TypedDict, total=False): - """Model with required and optional properties. - - :ivar optional_property: optional string property. - :vartype optional_property: str - :ivar required_property: required int property. Required. - :vartype required_property: int - """ - - optionalProperty: str - """optional string property.""" - requiredProperty: Required[int] - """required int property. Required.""" - - -class StringLiteralProperty(TypedDict, total=False): - """Model with string literal property. - - :ivar property: Property. Default value is "hello". - :vartype property: str - """ - - property: Literal["hello"] - """Property. Default value is \"hello\".""" - - -class StringProperty(TypedDict, total=False): - """Template type for testing models with optional property. Pass in the type of the property you - are looking for. - - :ivar property: Property. - :vartype property: str - """ - - property: str - """Property.""" - - -class UnionFloatLiteralProperty(TypedDict, total=False): - """Model with union of float literal property. - - :ivar property: Property. Is one of the following types: float - :vartype property: float or float - """ - - property: float - """Property. Is one of the following types: float""" - - -class UnionIntLiteralProperty(TypedDict, total=False): - """Model with union of int literal property. - - :ivar property: Property. Is either a Literal[1] type or a Literal[2] type. - :vartype property: int or int - """ - - property: Literal[1, 2] - """Property. Is either a Literal[1] type or a Literal[2] type.""" - - -class UnionStringLiteralProperty(TypedDict, total=False): - """Model with union of string literal property. - - :ivar property: Property. Is either a Literal["hello"] type or a Literal["world"] type. - :vartype property: str or str - """ - - property: Literal["hello", "world"] - """Property. Is either a Literal[\"hello\"] type or a Literal[\"world\"] type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/types.py deleted file mode 100644 index 3dd8ca24108c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/types.py +++ /dev/null @@ -1,342 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -import decimal -from typing import Any, Literal, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -from .models._enums import ExtendedEnum - -if TYPE_CHECKING: - from .models import FixedInnerEnum, InnerEnum - - -class BooleanLiteralProperty(TypedDict, total=False): - """Model with a boolean literal property. - - :ivar property: Property. Required. Default value is True. - :vartype property: bool - """ - - property: Required[Literal[True]] - """Property. Required. Default value is True.""" - - -class BooleanProperty(TypedDict, total=False): - """Model with a boolean property. - - :ivar property: Property. Required. - :vartype property: bool - """ - - property: Required[bool] - """Property. Required.""" - - -class BytesProperty(TypedDict, total=False): - """Model with a bytes property. - - :ivar property: Property. Required. - :vartype property: bytes - """ - - property: Required[bytes] - """Property. Required.""" - - -class CollectionsIntProperty(TypedDict, total=False): - """Model with collection int properties. - - :ivar property: Property. Required. - :vartype property: list[int] - """ - - property: Required[list[int]] - """Property. Required.""" - - -class CollectionsModelProperty(TypedDict, total=False): - """Model with collection model properties. - - :ivar property: Property. Required. - :vartype property: list[~typetest.property.valuetypes.models.InnerModel] - """ - - property: Required[list["InnerModel"]] - """Property. Required.""" - - -class CollectionsStringProperty(TypedDict, total=False): - """Model with collection string properties. - - :ivar property: Property. Required. - :vartype property: list[str] - """ - - property: Required[list[str]] - """Property. Required.""" - - -class DatetimeProperty(TypedDict, total=False): - """Model with a datetime property. - - :ivar property: Property. Required. - :vartype property: ~datetime.datetime - """ - - property: Required[datetime.datetime] - """Property. Required.""" - - -class Decimal128Property(TypedDict, total=False): - """Model with a decimal128 property. - - :ivar property: Property. Required. - :vartype property: ~decimal.Decimal - """ - - property: Required[decimal.Decimal] - """Property. Required.""" - - -class DecimalProperty(TypedDict, total=False): - """Model with a decimal property. - - :ivar property: Property. Required. - :vartype property: ~decimal.Decimal - """ - - property: Required[decimal.Decimal] - """Property. Required.""" - - -class DictionaryStringProperty(TypedDict, total=False): - """Model with dictionary string properties. - - :ivar property: Property. Required. - :vartype property: dict[str, str] - """ - - property: Required[dict[str, str]] - """Property. Required.""" - - -class DurationProperty(TypedDict, total=False): - """Model with a duration property. - - :ivar property: Property. Required. - :vartype property: ~datetime.timedelta - """ - - property: Required[datetime.timedelta] - """Property. Required.""" - - -class EnumProperty(TypedDict, total=False): - """Model with enum properties. - - :ivar property: Property. Required. Known values are: "ValueOne" and "ValueTwo". - :vartype property: str or ~typetest.property.valuetypes.models.FixedInnerEnum - """ - - property: Required[Union[str, "FixedInnerEnum"]] - """Property. Required. Known values are: \"ValueOne\" and \"ValueTwo\".""" - - -class ExtensibleEnumProperty(TypedDict, total=False): - """Model with extensible enum properties. - - :ivar property: Property. Required. Known values are: "ValueOne" and "ValueTwo". - :vartype property: str or ~typetest.property.valuetypes.models.InnerEnum - """ - - property: Required[Union[str, "InnerEnum"]] - """Property. Required. Known values are: \"ValueOne\" and \"ValueTwo\".""" - - -class FloatLiteralProperty(TypedDict, total=False): - """Model with a float literal property. - - :ivar property: Property. Required. Default value is 43.125. - :vartype property: float - """ - - property: Required[float] - """Property. Required. Default value is 43.125.""" - - -class FloatProperty(TypedDict, total=False): - """Model with a float property. - - :ivar property: Property. Required. - :vartype property: float - """ - - property: Required[float] - """Property. Required.""" - - -class InnerModel(TypedDict, total=False): - """Inner model. Will be a property type for ModelWithModelProperties. - - :ivar property: Required string property. Required. - :vartype property: str - """ - - property: Required[str] - """Required string property. Required.""" - - -class IntLiteralProperty(TypedDict, total=False): - """Model with a int literal property. - - :ivar property: Property. Required. Default value is 42. - :vartype property: int - """ - - property: Required[Literal[42]] - """Property. Required. Default value is 42.""" - - -class IntProperty(TypedDict, total=False): - """Model with a int property. - - :ivar property: Property. Required. - :vartype property: int - """ - - property: Required[int] - """Property. Required.""" - - -class ModelProperty(TypedDict, total=False): - """Model with model properties. - - :ivar property: Property. Required. - :vartype property: ~typetest.property.valuetypes.models.InnerModel - """ - - property: Required["InnerModel"] - """Property. Required.""" - - -class NeverProperty(TypedDict, total=False): - """Model with a property never. (This property should not be included).""" - - -class StringLiteralProperty(TypedDict, total=False): - """Model with a string literal property. - - :ivar property: Property. Required. Default value is "hello". - :vartype property: str - """ - - property: Required[Literal["hello"]] - """Property. Required. Default value is \"hello\".""" - - -class StringProperty(TypedDict, total=False): - """Model with a string property. - - :ivar property: Property. Required. - :vartype property: str - """ - - property: Required[str] - """Property. Required.""" - - -class UnionEnumValueProperty(TypedDict, total=False): - """Template type for testing models with specific properties. Pass in the type of the property you - are looking for. - - :ivar property: Property. Required. ENUM_VALUE2. - :vartype property: str or ~typetest.property.valuetypes.models.ENUM_VALUE2 - """ - - property: Required[Literal[ExtendedEnum.ENUM_VALUE2]] - """Property. Required. ENUM_VALUE2.""" - - -class UnionFloatLiteralProperty(TypedDict, total=False): - """Model with a union of float literal as property. - - :ivar property: Property. Required. Is one of the following types: float - :vartype property: float or float - """ - - property: Required[float] - """Property. Required. Is one of the following types: float""" - - -class UnionIntLiteralProperty(TypedDict, total=False): - """Model with a union of int literal as property. - - :ivar property: Property. Required. Is either a Literal[42] type or a Literal[43] type. - :vartype property: int or int - """ - - property: Required[Literal[42, 43]] - """Property. Required. Is either a Literal[42] type or a Literal[43] type.""" - - -class UnionStringLiteralProperty(TypedDict, total=False): - """Model with a union of string literal as property. - - :ivar property: Property. Required. Is either a Literal["hello"] type or a Literal["world"] - type. - :vartype property: str or str - """ - - property: Required[Literal["hello", "world"]] - """Property. Required. Is either a Literal[\"hello\"] type or a Literal[\"world\"] type.""" - - -class UnknownArrayProperty(TypedDict, total=False): - """Model with a property unknown, and the data is an array. - - :ivar property: Property. Required. - :vartype property: any - """ - - property: Required[Any] - """Property. Required.""" - - -class UnknownDictProperty(TypedDict, total=False): - """Model with a property unknown, and the data is a dictionnary. - - :ivar property: Property. Required. - :vartype property: any - """ - - property: Required[Any] - """Property. Required.""" - - -class UnknownIntProperty(TypedDict, total=False): - """Model with a property unknown, and the data is a int32. - - :ivar property: Property. Required. - :vartype property: any - """ - - property: Required[Any] - """Property. Required.""" - - -class UnknownStringProperty(TypedDict, total=False): - """Model with a property unknown, and the data is a string. - - :ivar property: Property. Required. - :vartype property: any - """ - - property: Required[Any] - """Property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/aio/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/models/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/models/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/operations/_patch.py index ea765788358a..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/types.py deleted file mode 100644 index 335021e075e3..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/typetest-union/typetest/union/types.py +++ /dev/null @@ -1,248 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import builtins -from typing import Literal, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import StringExtensibleNamedUnion - - -class Cat(TypedDict, total=False): - """Cat. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Dog(TypedDict, total=False): - """Dog. - - :ivar bark: Required. - :vartype bark: str - """ - - bark: Required[str] - """Required.""" - - -class EnumsOnlyCases(TypedDict, total=False): - """EnumsOnlyCases. - - :ivar lr: This should be receive/send the left variant. Required. Is one of the following - types: Literal["left"], Literal["right"], Literal["up"], Literal["down"] - :vartype lr: str or str or str or str - :ivar ud: This should be receive/send the up variant. Required. Is either a Literal["up"] type - or a Literal["down"] type. - :vartype ud: str or str - """ - - lr: Required[Literal["left", "right", "up", "down"]] - """This should be receive/send the left variant. Required. Is one of the following types: - Literal[\"left\"], Literal[\"right\"], Literal[\"up\"], Literal[\"down\"]""" - ud: Required[Literal["up", "down"]] - """This should be receive/send the up variant. Required. Is either a Literal[\"up\"] type or a - Literal[\"down\"] type.""" - - -class GetResponse(TypedDict, total=False): - """GetResponse. - - :ivar prop: Required. Is one of the following types: Literal["a"], Literal["b"], Literal["c"] - :vartype prop: str or str or str - """ - - prop: Required[Literal["a", "b", "c"]] - """Required. Is one of the following types: Literal[\"a\"], Literal[\"b\"], Literal[\"c\"]""" - - -class GetResponse1(TypedDict, total=False): - """GetResponse1. - - :ivar prop: Required. Is one of the following types: Literal["b"], Literal["c"], str - :vartype prop: str or str or str - """ - - prop: Required[Union[Literal["b"], Literal["c"], str]] - """Required. Is one of the following types: Literal[\"b\"], Literal[\"c\"], str""" - - -class GetResponse2(TypedDict, total=False): - """GetResponse2. - - :ivar prop: Required. Known values are: "b" and "c". - :vartype prop: str or ~typetest.union.models.StringExtensibleNamedUnion - """ - - prop: Required[Union[str, "StringExtensibleNamedUnion"]] - """Required. Known values are: \"b\" and \"c\".""" - - -class GetResponse3(TypedDict, total=False): - """GetResponse3. - - :ivar prop: Required. Is one of the following types: Literal[1], Literal[2], Literal[3] - :vartype prop: int or int or int - """ - - prop: Required[Literal[1, 2, 3]] - """Required. Is one of the following types: Literal[1], Literal[2], Literal[3]""" - - -class GetResponse4(TypedDict, total=False): - """GetResponse4. - - :ivar prop: Required. Is one of the following types: float - :vartype prop: float or float or float - """ - - prop: Required[float] - """Required. Is one of the following types: float""" - - -class GetResponse5(TypedDict, total=False): - """GetResponse5. - - :ivar prop: Required. Is either a Cat type or a Dog type. - :vartype prop: ~typetest.union.models.Cat or ~typetest.union.models.Dog - """ - - prop: Required[Union["Cat", "Dog"]] - """Required. Is either a Cat type or a Dog type.""" - - -class GetResponse6(TypedDict, total=False): - """GetResponse6. - - :ivar prop: Required. - :vartype prop: ~typetest.union.models.EnumsOnlyCases - """ - - prop: Required["EnumsOnlyCases"] - """Required.""" - - -class GetResponse7(TypedDict, total=False): - """GetResponse7. - - :ivar prop: Required. - :vartype prop: ~typetest.union.models.StringAndArrayCases - """ - - prop: Required["StringAndArrayCases"] - """Required.""" - - -class GetResponse8(TypedDict, total=False): - """GetResponse8. - - :ivar prop: Required. - :vartype prop: ~typetest.union.models.MixedLiteralsCases - """ - - prop: Required["MixedLiteralsCases"] - """Required.""" - - -class GetResponse9(TypedDict, total=False): - """GetResponse9. - - :ivar prop: Required. - :vartype prop: ~typetest.union.models.MixedTypesCases - """ - - prop: Required["MixedTypesCases"] - """Required.""" - - -class MixedLiteralsCases(TypedDict, total=False): - """MixedLiteralsCases. - - :ivar string_literal: This should be receive/send the "a" variant. Required. Is one of the - following types: Literal["a"], Literal[2], float, Literal[True] - :vartype string_literal: str or int or float or bool - :ivar int_literal: This should be receive/send the 2 variant. Required. Is one of the following - types: Literal["a"], Literal[2], float, Literal[True] - :vartype int_literal: str or int or float or bool - :ivar float_literal: This should be receive/send the 3.3 variant. Required. Is one of the - following types: Literal["a"], Literal[2], float, Literal[True] - :vartype float_literal: str or int or float or bool - :ivar boolean_literal: This should be receive/send the true variant. Required. Is one of the - following types: Literal["a"], Literal[2], float, Literal[True] - :vartype boolean_literal: str or int or float or bool - """ - - stringLiteral: Required[Literal["a", 2, True]] - """This should be receive/send the \"a\" variant. Required. Is one of the following types: - Literal[\"a\"], Literal[2], float, Literal[True]""" - intLiteral: Required[Literal["a", 2, True]] - """This should be receive/send the 2 variant. Required. Is one of the following types: - Literal[\"a\"], Literal[2], float, Literal[True]""" - floatLiteral: Required[Literal["a", 2, True]] - """This should be receive/send the 3.3 variant. Required. Is one of the following types: - Literal[\"a\"], Literal[2], float, Literal[True]""" - booleanLiteral: Required[Literal["a", 2, True]] - """This should be receive/send the true variant. Required. Is one of the following types: - Literal[\"a\"], Literal[2], float, Literal[True]""" - - -class MixedTypesCases(TypedDict, total=False): - """MixedTypesCases. - - :ivar model: This should be receive/send the Cat variant. Required. Is one of the following - types: Cat, Literal["a"], int, bool - :vartype model: ~typetest.union.models.Cat or str or int or bool - :ivar literal: This should be receive/send the "a" variant. Required. Is one of the following - types: Cat, Literal["a"], int, bool - :vartype literal: ~typetest.union.models.Cat or str or int or bool - :ivar int_property: This should be receive/send the int variant. Required. Is one of the - following types: Cat, Literal["a"], int, bool - :vartype int_property: ~typetest.union.models.Cat or str or int or bool - :ivar boolean: This should be receive/send the boolean variant. Required. Is one of the - following types: Cat, Literal["a"], int, bool - :vartype boolean: ~typetest.union.models.Cat or str or int or bool - :ivar array: This should be receive/send 4 element with Cat, "a", int, and boolean. Required. - :vartype array: list[~typetest.union.models.Cat or str or int or bool] - """ - - model: Required[Union["Cat", Literal["a"], builtins.int, bool]] - """This should be receive/send the Cat variant. Required. Is one of the following types: Cat, - Literal[\"a\"], int, bool""" - literal: Required[Union["Cat", Literal["a"], builtins.int, bool]] - """This should be receive/send the \"a\" variant. Required. Is one of the following types: Cat, - Literal[\"a\"], int, bool""" - int: Required[Union["Cat", Literal["a"], builtins.int, bool]] - """This should be receive/send the int variant. Required. Is one of the following types: Cat, - Literal[\"a\"], int, bool""" - boolean: Required[Union["Cat", Literal["a"], builtins.int, bool]] - """This should be receive/send the boolean variant. Required. Is one of the following types: Cat, - Literal[\"a\"], int, bool""" - array: Required[list[Union["Cat", Literal["a"], builtins.int, bool]]] - """This should be receive/send 4 element with Cat, \"a\", int, and boolean. Required.""" - - -class StringAndArrayCases(TypedDict, total=False): - """StringAndArrayCases. - - :ivar string: This should be receive/send the string variant. Required. Is either a str type or - a [str] type. - :vartype string: str or list[str] - :ivar array: This should be receive/send the array variant. Required. Is either a str type or a - [str] type. - :vartype array: str or list[str] - """ - - string: Required[Union[str, list[str]]] - """This should be receive/send the string variant. Required. Is either a str type or a [str] type.""" - array: Required[Union[str, list[str]]] - """This should be receive/send the array variant. Required. Is either a str type or a [str] type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/_unions.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/_unions.py deleted file mode 100644 index ad0f62c5c369..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/_unions.py +++ /dev/null @@ -1,12 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Union - -UnionV2 = Union[str, int] -UnionV1 = Union[str, int] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/types.py deleted file mode 100644 index 5ef150467a86..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-added/versioning/added/types.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from . import _unions - from .models import EnumV1, EnumV2 - - -class ModelV1(TypedDict, total=False): - """ModelV1. - - :ivar prop: Required. - :vartype prop: str - :ivar enum_prop: Required. Known values are: "enumMemberV1" and "enumMemberV2". - :vartype enum_prop: str or ~versioning.added.models.EnumV1 - :ivar union_prop: Required. Is either a str type or a int type. - :vartype union_prop: str or int - """ - - prop: Required[str] - """Required.""" - enumProp: Required[Union[str, "EnumV1"]] - """Required. Known values are: \"enumMemberV1\" and \"enumMemberV2\".""" - unionProp: Required["_unions.UnionV1"] - """Required. Is either a str type or a int type.""" - - -class ModelV2(TypedDict, total=False): - """ModelV2. - - :ivar prop: Required. - :vartype prop: str - :ivar enum_prop: Required. "enumMember" - :vartype enum_prop: str or ~versioning.added.models.EnumV2 - :ivar union_prop: Required. Is either a str type or a int type. - :vartype union_prop: str or int - """ - - prop: Required[str] - """Required.""" - enumProp: Required[Union[str, "EnumV2"]] - """Required. \"enumMember\"""" - unionProp: Required["_unions.UnionV2"] - """Required. Is either a str type or a int type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/types.py deleted file mode 100644 index cb0fa0b9709c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-madeoptional/versioning/madeoptional/types.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class TestModel(TypedDict, total=False): - """TestModel. - - :ivar prop: Required. - :vartype prop: str - :ivar changed_prop: - :vartype changed_prop: str - """ - - prop: Required[str] - """Required.""" - changedProp: str diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_unions.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_unions.py deleted file mode 100644 index d9eb2e02134b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/_unions.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Union - -UnionV2 = Union[str, float] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/types.py deleted file mode 100644 index ff89d3714691..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-removed/versioning/removed/types.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from . import _unions - from .models import EnumV2, EnumV3 - - -class ModelV2(TypedDict, total=False): - """ModelV2. - - :ivar prop: Required. - :vartype prop: str - :ivar enum_prop: Required. "enumMemberV2" - :vartype enum_prop: str or ~versioning.removed.models.EnumV2 - :ivar union_prop: Required. Is either a str type or a float type. - :vartype union_prop: str or float - """ - - prop: Required[str] - """Required.""" - enumProp: Required[Union[str, "EnumV2"]] - """Required. \"enumMemberV2\"""" - unionProp: Required["_unions.UnionV2"] - """Required. Is either a str type or a float type.""" - - -class ModelV3(TypedDict, total=False): - """ModelV3. - - :ivar id: Required. - :vartype id: str - :ivar enum_prop: Required. Known values are: "enumMemberV1" and "enumMemberV2Preview". - :vartype enum_prop: str or ~versioning.removed.models.EnumV3 - """ - - id: Required[str] - """Required.""" - enumProp: Required[Union[str, "EnumV3"]] - """Required. Known values are: \"enumMemberV1\" and \"enumMemberV2Preview\".""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_unions.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_unions.py deleted file mode 100644 index 6a0c99464d6c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_unions.py +++ /dev/null @@ -1,11 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Union - -NewUnion = Union[str, int] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/types.py deleted file mode 100644 index 22bcd4962fc4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-renamedfrom/versioning/renamedfrom/types.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from . import _unions - from .models import NewEnum - - -class NewModel(TypedDict, total=False): - """NewModel. - - :ivar new_prop: Required. - :vartype new_prop: str - :ivar enum_prop: Required. "newEnumMember" - :vartype enum_prop: str or ~versioning.renamedfrom.models.NewEnum - :ivar union_prop: Required. Is either a str type or a int type. - :vartype union_prop: str or int - """ - - newProp: Required[str] - """Required.""" - enumProp: Required[Union[str, "NewEnum"]] - """Required. \"newEnumMember\"""" - unionProp: Required["_unions.NewUnion"] - """Required. Is either a str type or a int type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py index b6400f50d7ce..87676c65a8f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py @@ -8,9 +8,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/types.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/types.py deleted file mode 100644 index d068771a512a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/types.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing_extensions import Required, TypedDict - - -class TestModel(TypedDict, total=False): - """TestModel. - - :ivar prop: Required. - :vartype prop: str - :ivar changed_prop: Required. - :vartype changed_prop: str - """ - - prop: Required[str] - """Required.""" - changedProp: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/types.py deleted file mode 100644 index 2f708b57c18d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-http-custom/authentication/http/custom/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class InvalidAuth(TypedDict, total=False): - """InvalidAuth. - - :ivar error: Required. - :vartype error: str - """ - - error: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/types.py deleted file mode 100644 index 2f708b57c18d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-oauth2/authentication/oauth2/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class InvalidAuth(TypedDict, total=False): - """InvalidAuth. - - :ivar error: Required. - :vartype error: str - """ - - error: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/authentication-union/authentication/union/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/types.py deleted file mode 100644 index a8518fe09755..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/types.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class Base64BytesProperty(TypedDict, total=False): - """Base64BytesProperty. - - :ivar value: Required. - :vartype value: bytes - """ - - value: Required[bytes] - """Required.""" - - -class Base64urlArrayBytesProperty(TypedDict, total=False): - """Base64urlArrayBytesProperty. - - :ivar value: Required. - :vartype value: list[bytes] - """ - - value: Required[list[bytes]] - """Required.""" - - -class Base64urlBytesProperty(TypedDict, total=False): - """Base64urlBytesProperty. - - :ivar value: Required. - :vartype value: bytes - """ - - value: Required[bytes] - """Required.""" - - -class DefaultBytesProperty(TypedDict, total=False): - """DefaultBytesProperty. - - :ivar value: Required. - :vartype value: bytes - """ - - value: Required[bytes] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/types.py deleted file mode 100644 index 0725a7d3a02e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-datetime/encode/datetime/types.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 - -import datetime -from typing_extensions import Required, TypedDict - - -class DefaultDatetimeProperty(TypedDict, total=False): - """DefaultDatetimeProperty. - - :ivar value: Required. - :vartype value: ~datetime.datetime - """ - - value: Required[datetime.datetime] - """Required.""" - - -class Rfc3339DatetimeProperty(TypedDict, total=False): - """Rfc3339DatetimeProperty. - - :ivar value: Required. - :vartype value: ~datetime.datetime - """ - - value: Required[datetime.datetime] - """Required.""" - - -class Rfc7231DatetimeProperty(TypedDict, total=False): - """Rfc7231DatetimeProperty. - - :ivar value: Required. - :vartype value: ~datetime.datetime - """ - - value: Required[datetime.datetime] - """Required.""" - - -class UnixTimestampArrayDatetimeProperty(TypedDict, total=False): - """UnixTimestampArrayDatetimeProperty. - - :ivar value: Required. - :vartype value: list[~datetime.datetime] - """ - - value: Required[list[datetime.datetime]] - """Required.""" - - -class UnixTimestampDatetimeProperty(TypedDict, total=False): - """UnixTimestampDatetimeProperty. - - :ivar value: Required. - :vartype value: ~datetime.datetime - """ - - value: Required[datetime.datetime] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/types.py deleted file mode 100644 index 7b9fe5b386d9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/property/types.py +++ /dev/null @@ -1,158 +0,0 @@ -# coding=utf-8 - -import datetime -from typing_extensions import Required, TypedDict - - -class DefaultDurationProperty(TypedDict, total=False): - """DefaultDurationProperty. - - :ivar value: Required. - :vartype value: ~datetime.timedelta - """ - - value: Required[datetime.timedelta] - """Required.""" - - -class Float64MillisecondsDurationProperty(TypedDict, total=False): - """Float64MillisecondsDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class Float64SecondsDurationProperty(TypedDict, total=False): - """Float64SecondsDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class FloatMillisecondsDurationArrayProperty(TypedDict, total=False): - """FloatMillisecondsDurationArrayProperty. - - :ivar value: Required. - :vartype value: list[float] - """ - - value: Required[list[float]] - """Required.""" - - -class FloatMillisecondsDurationProperty(TypedDict, total=False): - """FloatMillisecondsDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class FloatMillisecondsLargerUnitDurationProperty(TypedDict, total=False): # pylint: disable=name-too-long - """FloatMillisecondsLargerUnitDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class FloatSecondsDurationArrayProperty(TypedDict, total=False): - """FloatSecondsDurationArrayProperty. - - :ivar value: Required. - :vartype value: list[float] - """ - - value: Required[list[float]] - """Required.""" - - -class FloatSecondsDurationProperty(TypedDict, total=False): - """FloatSecondsDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class FloatSecondsLargerUnitDurationProperty(TypedDict, total=False): - """FloatSecondsLargerUnitDurationProperty. - - :ivar value: Required. - :vartype value: float - """ - - value: Required[float] - """Required.""" - - -class Int32MillisecondsDurationProperty(TypedDict, total=False): - """Int32MillisecondsDurationProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class Int32MillisecondsLargerUnitDurationProperty(TypedDict, total=False): # pylint: disable=name-too-long - """Int32MillisecondsLargerUnitDurationProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class Int32SecondsDurationProperty(TypedDict, total=False): - """Int32SecondsDurationProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class Int32SecondsLargerUnitDurationProperty(TypedDict, total=False): - """Int32SecondsLargerUnitDurationProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class ISO8601DurationProperty(TypedDict, total=False): - """ISO8601DurationProperty. - - :ivar value: Required. - :vartype value: ~datetime.timedelta - """ - - value: Required[datetime.timedelta] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/types.py deleted file mode 100644 index 5647f691cdad..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-numeric/encode/numeric/property/types.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class SafeintAsStringProperty(TypedDict, total=False): - """SafeintAsStringProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" - - -class Uint32AsStringProperty(TypedDict, total=False): - """Uint32AsStringProperty. - - :ivar value: - :vartype value: int - """ - - value: int - - -class Uint8AsStringProperty(TypedDict, total=False): - """Uint8AsStringProperty. - - :ivar value: Required. - :vartype value: int - """ - - value: Required[int] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/types.py deleted file mode 100644 index cc6ecea8a81a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleanfalse/headasbooleanfalse/types.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 - -from typing import Optional -from typing_extensions import Required, TypedDict - - -class ReadOnlyModel(TypedDict, total=False): - """RoundTrip model with readonly optional properties. - - :ivar optional_nullable_int_list: Optional readonly nullable int list. - :vartype optional_nullable_int_list: list[int] - :ivar optional_string_record: Optional readonly string dictionary. - :vartype optional_string_record: dict[str, str] - """ - - optionalNullableIntList: Optional[list[int]] - """Optional readonly nullable int list.""" - optionalStringRecord: dict[str, str] - """Optional readonly string dictionary.""" - - -class VisibilityModel(TypedDict, total=False): - """Output model with visibility properties. - - :ivar read_prop: Required string, illustrating a readonly property. Required. - :vartype read_prop: str - :ivar create_prop: Required string[], illustrating a create property. Required. - :vartype create_prop: list[str] - :ivar update_prop: Required int32[], illustrating a update property. Required. - :vartype update_prop: list[int] - :ivar delete_prop: Required bool, illustrating a delete property. Required. - :vartype delete_prop: bool - """ - - readProp: Required[str] - """Required string, illustrating a readonly property. Required.""" - createProp: Required[list[str]] - """Required string[], illustrating a create property. Required.""" - updateProp: Required[list[int]] - """Required int32[], illustrating a update property. Required.""" - deleteProp: Required[bool] - """Required bool, illustrating a delete property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/types.py deleted file mode 100644 index cc6ecea8a81a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/headasbooleantrue/headasbooleantrue/types.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 - -from typing import Optional -from typing_extensions import Required, TypedDict - - -class ReadOnlyModel(TypedDict, total=False): - """RoundTrip model with readonly optional properties. - - :ivar optional_nullable_int_list: Optional readonly nullable int list. - :vartype optional_nullable_int_list: list[int] - :ivar optional_string_record: Optional readonly string dictionary. - :vartype optional_string_record: dict[str, str] - """ - - optionalNullableIntList: Optional[list[int]] - """Optional readonly nullable int list.""" - optionalStringRecord: dict[str, str] - """Optional readonly string dictionary.""" - - -class VisibilityModel(TypedDict, total=False): - """Output model with visibility properties. - - :ivar read_prop: Required string, illustrating a readonly property. Required. - :vartype read_prop: str - :ivar create_prop: Required string[], illustrating a create property. Required. - :vartype create_prop: list[str] - :ivar update_prop: Required int32[], illustrating a update property. Required. - :vartype update_prop: list[int] - :ivar delete_prop: Required bool, illustrating a delete property. Required. - :vartype delete_prop: bool - """ - - readProp: Required[str] - """Required string, illustrating a readonly property. Required.""" - createProp: Required[list[str]] - """Required string[], illustrating a create property. Required.""" - updateProp: Required[list[int]] - """Required int32[], illustrating a update property. Required.""" - deleteProp: Required[bool] - """Required bool, illustrating a delete property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/types.py deleted file mode 100644 index 720ff7aee7e1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/explicitbody/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class User(TypedDict, total=False): - """This is a simple model. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/types.py deleted file mode 100644 index e5638b2b70da..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class BodyModel(TypedDict, total=False): - """BodyModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-path/parameters/path/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/aio/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/aio/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-query/parameters/query/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/types.py deleted file mode 100644 index ed76d0a0d674..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/parameters-spread/parameters/spread/model/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class BodyParameter(TypedDict, total=False): - """This is a simple model. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/types.py deleted file mode 100644 index 8d5f52e7d95a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class PngImageAsJson(TypedDict, total=False): - """PngImageAsJson. - - :ivar content: Required. - :vartype content: bytes - """ - - content: Required[bytes] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/_operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/_operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/aio/_operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/aio/_operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/aio/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-head/payload/head/aio/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/types.py deleted file mode 100644 index b762b6a5f009..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/types.py +++ /dev/null @@ -1,76 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class InnerModel(TypedDict, total=False): - """It is the model used by Resource model. - - :ivar name: - :vartype name: str - :ivar description: - :vartype description: str - """ - - name: str - description: str - - -class Resource(TypedDict, total=False): - """Details about a resource. - - :ivar name: Required. - :vartype name: str - :ivar description: - :vartype description: str - :ivar map: - :vartype map: dict[str, ~payload.jsonmergepatch.models.InnerModel] - :ivar array: - :vartype array: list[~payload.jsonmergepatch.models.InnerModel] - :ivar int_value: - :vartype int_value: int - :ivar float_value: - :vartype float_value: float - :ivar inner_model: - :vartype inner_model: ~payload.jsonmergepatch.models.InnerModel - :ivar int_array: - :vartype int_array: list[int] - """ - - name: Required[str] - """Required.""" - description: str - map: dict[str, "InnerModel"] - array: list["InnerModel"] - intValue: int - floatValue: float - innerModel: "InnerModel" - intArray: list[int] - - -class ResourcePatch(TypedDict, total=False): - """Details about a resource for patch operation. - - :ivar description: - :vartype description: str - :ivar map: - :vartype map: dict[str, ~payload.jsonmergepatch.models.InnerModel] - :ivar array: - :vartype array: list[~payload.jsonmergepatch.models.InnerModel] - :ivar int_value: - :vartype int_value: int - :ivar float_value: - :vartype float_value: float - :ivar inner_model: - :vartype inner_model: ~payload.jsonmergepatch.models.InnerModel - :ivar int_array: - :vartype int_array: list[int] - """ - - description: str - map: dict[str, "InnerModel"] - array: list["InnerModel"] - intValue: int - floatValue: float - innerModel: "InnerModel" - intArray: list[int] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/types.py deleted file mode 100644 index a5c98f2da3e1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/file/types.py +++ /dev/null @@ -1,38 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - -from ..._utils.utils import FileType - - -class UploadFileArrayRequest(TypedDict, total=False): - """UploadFileArrayRequest. - - :ivar files: Required. - :vartype files: list[~payload.multipart._utils.utils.FileType] - """ - - files: Required[list[FileType]] - """Required.""" - - -class UploadFileRequiredFilenameRequest(TypedDict, total=False): - """UploadFileRequiredFilenameRequest. - - :ivar file: Required. - :vartype file: ~payload.multipart._utils.utils.FileType - """ - - file: Required[FileType] - """Required.""" - - -class UploadFileSpecificContentTypeRequest(TypedDict, total=False): - """UploadFileSpecificContentTypeRequest. - - :ivar file: Required. - :vartype file: ~payload.multipart._utils.utils.FileType - """ - - file: Required[FileType] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/types.py deleted file mode 100644 index 48a9bb664fa4..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class FloatRequest(TypedDict, total=False): - """FloatRequest. - - :ivar temperature: Required. - :vartype temperature: float - """ - - temperature: Required[float] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/types.py deleted file mode 100644 index ac13bd6283f6..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/formdata/types.py +++ /dev/null @@ -1,16 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - -from .._utils.utils import FileType - - -class AnonymousModelRequest(TypedDict, total=False): - """AnonymousModelRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/types.py deleted file mode 100644 index 80d8dddf253d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-multipart/payload/multipart/types.py +++ /dev/null @@ -1,186 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - -from ._utils.utils import FileType - - -class Address(TypedDict, total=False): - """Address. - - :ivar city: Required. - :vartype city: str - """ - - city: Required[str] - """Required.""" - - -class BinaryArrayPartsRequest(TypedDict, total=False): - """BinaryArrayPartsRequest. - - :ivar id: Required. - :vartype id: str - :ivar pictures: Required. - :vartype pictures: list[~payload.multipart._utils.utils.FileType] - """ - - id: Required[str] - """Required.""" - pictures: Required[list[FileType]] - """Required.""" - - -class ComplexHttpPartsModelRequest(TypedDict, total=False): - """ComplexHttpPartsModelRequest. - - :ivar id: Required. - :vartype id: str - :ivar address: Required. - :vartype address: ~payload.multipart.models.Address - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - :ivar previous_addresses: Required. - :vartype previous_addresses: list[~payload.multipart.models.Address] - :ivar pictures: Required. - :vartype pictures: list[~payload.multipart._utils.utils.FileType] - """ - - id: Required[str] - """Required.""" - address: Required["Address"] - """Required.""" - profileImage: Required[FileType] - """Required.""" - previousAddresses: Required[list["Address"]] - """Required.""" - pictures: Required[list[FileType]] - """Required.""" - - -class ComplexPartsRequest(TypedDict, total=False): - """ComplexPartsRequest. - - :ivar id: Required. - :vartype id: str - :ivar address: Required. - :vartype address: ~payload.multipart.models.Address - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - :ivar pictures: Required. - :vartype pictures: list[~payload.multipart._utils.utils.FileType] - """ - - id: Required[str] - """Required.""" - address: Required["Address"] - """Required.""" - profileImage: Required[FileType] - """Required.""" - pictures: Required[list[FileType]] - """Required.""" - - -class FileWithHttpPartOptionalContentTypeRequest(TypedDict, total=False): # pylint: disable=name-too-long - """FileWithHttpPartOptionalContentTypeRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" - - -class FileWithHttpPartRequiredContentTypeRequest(TypedDict, total=False): # pylint: disable=name-too-long - """FileWithHttpPartRequiredContentTypeRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" - - -class FileWithHttpPartSpecificContentTypeRequest(TypedDict, total=False): # pylint: disable=name-too-long - """FileWithHttpPartSpecificContentTypeRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" - - -class JsonPartRequest(TypedDict, total=False): - """JsonPartRequest. - - :ivar address: Required. - :vartype address: ~payload.multipart.models.Address - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - address: Required["Address"] - """Required.""" - profileImage: Required[FileType] - """Required.""" - - -class MultiBinaryPartsRequest(TypedDict, total=False): - """MultiBinaryPartsRequest. - - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - :ivar picture: - :vartype picture: ~payload.multipart._utils.utils.FileType - """ - - profileImage: Required[FileType] - """Required.""" - picture: FileType - - -class MultiPartOptionalRequest(TypedDict, total=False): - """MultiPartOptionalRequest. - - :ivar id: - :vartype id: str - :ivar profile_image: - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - id: str - profileImage: FileType - - -class MultiPartRequest(TypedDict, total=False): - """MultiPartRequest. - - :ivar id: Required. - :vartype id: str - :ivar profile_image: Required. - :vartype profile_image: ~payload.multipart._utils.utils.FileType - """ - - id: Required[str] - """Required.""" - profileImage: Required[FileType] - """Required.""" - - -class MultiPartRequestWithWireName(TypedDict, total=False): - """MultiPartRequestWithWireName. - - :ivar identifier: Required. - :vartype identifier: str - :ivar image: Required. - :vartype image: ~payload.multipart._utils.utils.FileType - """ - - id: Required[str] - """Required.""" - profileImage: Required[FileType] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_operations/__init__.py deleted file mode 100644 index 87946fdeb71f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _PageableClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_operations/_operations.py deleted file mode 100644 index f6d38edf6dee..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_operations/_operations.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding=utf-8 -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from corehttp.paging import ItemPaged -from corehttp.rest import HttpRequest, HttpResponse -from corehttp.runtime import PipelineClient -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.utils import case_insensitive_dict - -from .. import models as _models1 -from .._configuration import PageableClientConfiguration -from .._utils.model_base import _deserialize -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_pageable_list_without_continuation_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/payload/pageable/simple" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -class _PageableClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], PageableClientConfiguration] -): - - def list_without_continuation(self, **kwargs: Any) -> ItemPaged["_models1.Pet"]: - """list_without_continuation. - - :return: An iterator like instance of Pet - :rtype: ~corehttp.paging.ItemPaged[~payload.pageable.models.Pet] - :raises ~corehttp.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[list[_models1.Pet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_pageable_list_without_continuation_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - _request = HttpRequest("GET", next_link) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models1.Pet], deserialized.get("pets", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py deleted file mode 100644 index b208fb11fbc2..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_utils/utils.py deleted file mode 100644 index 02aa2f816ea7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/_utils/utils.py +++ /dev/null @@ -1,18 +0,0 @@ -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/__init__.py deleted file mode 100644 index 87946fdeb71f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _PageableClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_operations.py deleted file mode 100644 index f1f9632422ce..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from corehttp.paging import AsyncItemPaged, AsyncList -from corehttp.rest import AsyncHttpResponse, HttpRequest -from corehttp.runtime import AsyncPipelineClient -from corehttp.runtime.pipeline import PipelineResponse - -from ... import models as _models2 -from ..._operations._operations import build_pageable_list_without_continuation_request -from ..._utils.model_base import _deserialize -from ..._utils.utils import ClientMixinABC -from .._configuration import PageableClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _PageableClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], PageableClientConfiguration] -): - - def list_without_continuation(self, **kwargs: Any) -> AsyncItemPaged["_models2.Pet"]: - """list_without_continuation. - - :return: An iterator like instance of Pet - :rtype: ~corehttp.paging.AsyncItemPaged[~payload.pageable.models.Pet] - :raises ~corehttp.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[list[_models2.Pet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_pageable_list_without_continuation_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - _request = HttpRequest("GET", next_link) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2.Pet], deserialized.get("pets", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py deleted file mode 100644 index b208fb11fbc2..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/types.py deleted file mode 100644 index e863c3e447d7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class Filter(TypedDict, total=False): - """Filter. - - :ivar filter: Required. - :vartype filter: str - """ - - filter: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/types.py deleted file mode 100644 index a13b29e1db4b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/types.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 - -from typing import TYPE_CHECKING -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from ...types import Pet - - -class RequestHeaderNestedResponseBodyResponseNestedItems(TypedDict, total=False): # pylint: disable=name-too-long - """RequestHeaderNestedResponseBodyResponseNestedItems. - - :ivar pets: Required. - :vartype pets: list[~payload.pageable.models.Pet] - """ - - pets: Required[list["Pet"]] - """Required.""" - - -class RequestHeaderNestedResponseBodyResponseNestedNext(TypedDict, total=False): # pylint: disable=name-too-long - """RequestHeaderNestedResponseBodyResponseNestedNext. - - :ivar next_token: - :vartype next_token: str - """ - - nextToken: str - - -class RequestQueryNestedResponseBodyResponseNestedItems(TypedDict, total=False): # pylint: disable=name-too-long - """RequestQueryNestedResponseBodyResponseNestedItems. - - :ivar pets: Required. - :vartype pets: list[~payload.pageable.models.Pet] - """ - - pets: Required[list["Pet"]] - """Required.""" - - -class RequestQueryNestedResponseBodyResponseNestedNext(TypedDict, total=False): # pylint: disable=name-too-long - """RequestQueryNestedResponseBodyResponseNestedNext. - - :ivar next_token: - :vartype next_token: str - """ - - nextToken: str diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/types.py deleted file mode 100644 index b01973310852..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/types.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 - -from typing import TYPE_CHECKING -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from ..types import Pet - - -class NestedLinkResponseNestedItems(TypedDict, total=False): - """NestedLinkResponseNestedItems. - - :ivar pets: Required. - :vartype pets: list[~payload.pageable.models.Pet] - """ - - pets: Required[list["Pet"]] - """Required.""" - - -class NestedLinkResponseNestedNext(TypedDict, total=False): - """NestedLinkResponseNestedNext. - - :ivar next: - :vartype next: str - """ - - next: str diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/types.py deleted file mode 100644 index 80f1fc4f61f2..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/types.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class Pet(TypedDict, total=False): - """Pet. - - :ivar id: Required. - :vartype id: str - :ivar name: Required. - :vartype name: str - """ - - id: Required[str] - """Required.""" - name: Required[str] - """Required.""" - - -class XmlPet(TypedDict, total=False): - """An XML pet item. - - :ivar id: Required. - :vartype id: str - :ivar name: Required. - :vartype name: str - """ - - id: Required[str] - """Required.""" - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/types.py deleted file mode 100644 index 08e0f39153be..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/payload-xml/payload/xml/types.py +++ /dev/null @@ -1,388 +0,0 @@ -# coding=utf-8 - -import datetime -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import Status - - -class Author(TypedDict, total=False): - """Author model with a custom XML name. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Book(TypedDict, total=False): - """Book model with a custom XML name. - - :ivar title: Required. - :vartype title: str - """ - - title: Required[str] - """Required.""" - - -class ModelWithArrayOfModel(TypedDict, total=False): - """§4.1 — Contains an array of models. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithAttributes(TypedDict, total=False): - """§5.1 — Contains fields that are XML attributes. - - :ivar id1: Required. - :vartype id1: int - :ivar id2: Required. - :vartype id2: str - :ivar enabled: Required. - :vartype enabled: bool - """ - - id1: Required[int] - """Required.""" - id2: Required[str] - """Required.""" - enabled: Required[bool] - """Required.""" - - -class ModelWithDatetime(TypedDict, total=False): - """Contains datetime properties with different encodings. - - :ivar rfc3339: DateTime value with rfc3339 encoding. Required. - :vartype rfc3339: ~datetime.datetime - :ivar rfc7231: DateTime value with rfc7231 encoding. Required. - :vartype rfc7231: ~datetime.datetime - """ - - rfc3339: Required[datetime.datetime] - """DateTime value with rfc3339 encoding. Required.""" - rfc7231: Required[datetime.datetime] - """DateTime value with rfc7231 encoding. Required.""" - - -class ModelWithDictionary(TypedDict, total=False): - """Contains a dictionary of key value pairs. - - :ivar metadata: Required. - :vartype metadata: dict[str, str] - """ - - metadata: Required[dict[str, str]] - """Required.""" - - -class ModelWithEmptyArray(TypedDict, total=False): - """Contains an array of models that's supposed to be sent/received as an empty XML element. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithEncodedNames(TypedDict, total=False): - """Uses encodedName instead of Xml.Name which is functionally equivalent. - - :ivar model_data: Required. - :vartype model_data: ~payload.xml.models.SimpleModel - :ivar colors: Required. - :vartype colors: list[str] - """ - - modelData: Required["SimpleModel"] - """Required.""" - colors: Required[list[str]] - """Required.""" - - -class ModelWithEnum(TypedDict, total=False): - """Contains a single property with an enum value. - - :ivar status: Required. Known values are: "pending", "success", and "error". - :vartype status: str or ~payload.xml.models.Status - """ - - status: Required[Union[str, "Status"]] - """Required. Known values are: \"pending\", \"success\", and \"error\".""" - - -class ModelWithNamespace(TypedDict, total=False): - """§6.1, §7.1 — Contains fields with XML namespace on the model. - - :ivar id: Required. - :vartype id: int - :ivar title: Required. - :vartype title: str - """ - - id: Required[int] - """Required.""" - title: Required[str] - """Required.""" - - -class ModelWithNamespaceOnProperties(TypedDict, total=False): - """§6.2, §7.2 — Contains fields with different XML namespaces on individual properties. - - :ivar id: Required. - :vartype id: int - :ivar title: Required. - :vartype title: str - :ivar author: Required. - :vartype author: str - """ - - id: Required[int] - """Required.""" - title: Required[str] - """Required.""" - author: Required[str] - """Required.""" - - -class ModelWithNestedModel(TypedDict, total=False): - """§2.1 — Contains a property that references another model. - - :ivar nested: Required. - :vartype nested: ~payload.xml.models.SimpleModel - """ - - nested: Required["SimpleModel"] - """Required.""" - - -class ModelWithOptionalField(TypedDict, total=False): - """Contains an optional field. - - :ivar item: Required. - :vartype item: str - :ivar value: - :vartype value: int - """ - - item: Required[str] - """Required.""" - value: int - - -class ModelWithRenamedArrays(TypedDict, total=False): - """§3.3, §3.4 — Contains fields of wrapped and unwrapped arrays of primitive types that have - different XML representations. - - :ivar colors: Required. - :vartype colors: list[str] - :ivar counts: Required. - :vartype counts: list[int] - """ - - colors: Required[list[str]] - """Required.""" - counts: Required[list[int]] - """Required.""" - - -class ModelWithRenamedAttribute(TypedDict, total=False): - """§5.2 — Contains a renamed XML attribute. - - :ivar id: Required. - :vartype id: int - :ivar title: Required. - :vartype title: str - :ivar author: Required. - :vartype author: str - """ - - id: Required[int] - """Required.""" - title: Required[str] - """Required.""" - author: Required[str] - """Required.""" - - -class ModelWithRenamedFields(TypedDict, total=False): - """§1.3, §2.3 — Contains fields of the same type that have different XML representation. - - :ivar input_data: Required. - :vartype input_data: ~payload.xml.models.SimpleModel - :ivar output_data: Required. - :vartype output_data: ~payload.xml.models.SimpleModel - """ - - inputData: Required["SimpleModel"] - """Required.""" - outputData: Required["SimpleModel"] - """Required.""" - - -class ModelWithRenamedNestedModel(TypedDict, total=False): - """§2.2 — Contains a property whose type has. - - :ivar author: Required. - :vartype author: ~payload.xml.models.Author - """ - - author: Required["Author"] - """Required.""" - - -class ModelWithRenamedProperty(TypedDict, total=False): - """§1.2 — Contains a scalar property with a custom XML name. - - :ivar title: Required. - :vartype title: str - :ivar author: Required. - :vartype author: str - """ - - title: Required[str] - """Required.""" - author: Required[str] - """Required.""" - - -class ModelWithRenamedUnwrappedModelArray(TypedDict, total=False): - """§4.4 — Contains an unwrapped array of models with a custom item name. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithRenamedWrappedAndItemModelArray(TypedDict, total=False): - """§4.5 — Contains a wrapped array of models with custom wrapper and item names. - - :ivar books: Required. - :vartype books: ~payload.xml.models.Book - """ - - books: Required[list["Book"]] - """Required.""" - - -class ModelWithRenamedWrappedModelArray(TypedDict, total=False): - """§4.3 — Contains a wrapped array of models with a custom wrapper name. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithSimpleArrays(TypedDict, total=False): - """§3.1 — Contains fields of arrays of primitive types. - - :ivar colors: Required. - :vartype colors: list[str] - :ivar counts: Required. - :vartype counts: list[int] - """ - - colors: Required[list[str]] - """Required.""" - counts: Required[list[int]] - """Required.""" - - -class ModelWithText(TypedDict, total=False): - """§8.1 — Contains an attribute and text. - - :ivar language: Required. - :vartype language: str - :ivar content: Required. - :vartype content: str - """ - - language: Required[str] - """Required.""" - content: Required[str] - """Required.""" - - -class ModelWithUnwrappedArray(TypedDict, total=False): - """§3.2 — Contains fields of wrapped and unwrapped arrays of primitive types. - - :ivar colors: Required. - :vartype colors: list[str] - :ivar counts: Required. - :vartype counts: list[int] - """ - - colors: Required[list[str]] - """Required.""" - counts: Required[list[int]] - """Required.""" - - -class ModelWithUnwrappedModelArray(TypedDict, total=False): - """§4.2 — Contains an unwrapped array of models. - - :ivar items_property: Required. - :vartype items_property: ~payload.xml.models.SimpleModel - """ - - items: Required[list["SimpleModel"]] - """Required.""" - - -class ModelWithWrappedPrimitiveCustomItemNames(TypedDict, total=False): - """§3.5 — Contains a wrapped primitive array with custom wrapper and item names. - - :ivar tags: Required. - :vartype tags: list[str] - """ - - tags: Required[list[str]] - """Required.""" - - -class SimpleModel(TypedDict, total=False): - """§1.1 — Contains fields of primitive types. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - """ - - name: Required[str] - """Required.""" - age: Required[int] - """Required.""" - - -class XmlErrorBody(TypedDict, total=False): - """The body of an XML error response. - - :ivar message: Required. - :vartype message: str - :ivar code: Required. - :vartype code: int - """ - - message: Required[str] - """Required.""" - code: Required[int] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/types.py deleted file mode 100644 index 8a64fba89dad..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/response-status-code-range/response/statuscoderange/types.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class DefaultError(TypedDict, total=False): - """DefaultError. - - :ivar code: Required. - :vartype code: str - """ - - code: Required[str] - """Required.""" - - -class ErrorInRange(TypedDict, total=False): - """ErrorInRange. - - :ivar code: Required. - :vartype code: str - :ivar message: Required. - :vartype message: str - """ - - code: Required[str] - """Required.""" - message: Required[str] - """Required.""" - - -class NotFoundError(TypedDict, total=False): - """NotFoundError. - - :ivar code: Required. - :vartype code: str - :ivar resource_id: Required. - :vartype resource_id: str - """ - - code: Required[str] - """Required.""" - resourceId: Required[str] - """Required.""" - - -class Standard4XXError(TypedDict, total=False): - """Standard4XXError. - - :ivar code: Required. - :vartype code: str - """ - - code: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/types.py deleted file mode 100644 index 7e6e4a381061..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class JsonEncodedNameModel(TypedDict, total=False): - """JsonEncodedNameModel. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - wireName: Required[bool] - """Pass in true. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-path-single/server/path/single/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/types.py deleted file mode 100644 index 5193e14ed950..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/modelproperties/types.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class DictMethods(TypedDict, total=False): - """DictMethods. - - :ivar keys_property: Required. - :vartype keys_property: str - :ivar items_property: Required. - :vartype items_property: str - :ivar values_property: Required. - :vartype values_property: str - :ivar popitem_property: Required. - :vartype popitem_property: str - :ivar clear_property: Required. - :vartype clear_property: str - :ivar update_property: Required. - :vartype update_property: str - :ivar setdefault_property: Required. - :vartype setdefault_property: str - :ivar pop_property: Required. - :vartype pop_property: str - :ivar get_property: Required. - :vartype get_property: str - :ivar copy_property: Required. - :vartype copy_property: str - """ - - keys: Required[str] - """Required.""" - items: Required[str] - """Required.""" - values: Required[str] - """Required.""" - popitem: Required[str] - """Required.""" - clear: Required[str] - """Required.""" - update: Required[str] - """Required.""" - setdefault: Required[str] - """Required.""" - pop: Required[str] - """Required.""" - get: Required[str] - """Required.""" - copy: Required[str] - """Required.""" - - -class ModelWithList(TypedDict, total=False): - """ModelWithList. - - :ivar list: Required. - :vartype list: str - """ - - list: Required[str] - """Required.""" - - -class SameAsModel(TypedDict, total=False): - """SameAsModel. - - :ivar same_as_model: Required. - :vartype same_as_model: str - """ - - SameAsModel: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/types.py deleted file mode 100644 index 2843efd12fc2..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/models/types.py +++ /dev/null @@ -1,366 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class AndModel(TypedDict, total=False): - """AndModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class AsModel(TypedDict, total=False): - """AsModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class AssertModel(TypedDict, total=False): - """AssertModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class AsyncModel(TypedDict, total=False): - """AsyncModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class AwaitModel(TypedDict, total=False): - """AwaitModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class BreakModel(TypedDict, total=False): - """BreakModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ClassModel(TypedDict, total=False): - """ClassModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Constructor(TypedDict, total=False): - """Constructor. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ContinueModel(TypedDict, total=False): - """ContinueModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class DefModel(TypedDict, total=False): - """DefModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class DelModel(TypedDict, total=False): - """DelModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ElifModel(TypedDict, total=False): - """ElifModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ElseModel(TypedDict, total=False): - """ElseModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ExceptModel(TypedDict, total=False): - """ExceptModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ExecModel(TypedDict, total=False): - """ExecModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class FinallyModel(TypedDict, total=False): - """FinallyModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ForModel(TypedDict, total=False): - """ForModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class FromModel(TypedDict, total=False): - """FromModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class GlobalModel(TypedDict, total=False): - """GlobalModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class IfModel(TypedDict, total=False): - """IfModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ImportModel(TypedDict, total=False): - """ImportModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class InModel(TypedDict, total=False): - """InModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class IsModel(TypedDict, total=False): - """IsModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class LambdaModel(TypedDict, total=False): - """LambdaModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class NotModel(TypedDict, total=False): - """NotModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class OrModel(TypedDict, total=False): - """OrModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class PassModel(TypedDict, total=False): - """PassModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class RaiseModel(TypedDict, total=False): - """RaiseModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class ReturnModel(TypedDict, total=False): - """ReturnModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class TryModel(TypedDict, total=False): - """TryModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class WhileModel(TypedDict, total=False): - """WhileModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class WithModel(TypedDict, total=False): - """WithModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class YieldModel(TypedDict, total=False): - """YieldModel. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/reservedoperationbodyparams/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/reservedoperationbodyparams/aio/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/reservedoperationbodyparams/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/reservedoperationbodyparams/aio/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/reservedoperationbodyparams/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/reservedoperationbodyparams/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/reservedoperationbodyparams/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/special-words/specialwords/reservedoperationbodyparams/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/types.py deleted file mode 100644 index 1a5fba439634..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/specs-documentation/specs/documentation/types.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import BulletPointsEnum - - -class BulletPointsModel(TypedDict, total=False): - """This tests: - - * Simple bullet point. This bullet point is going to be very long to test how text wrapping is - handled in bullet points within documentation comments. It should properly indent the wrapped - lines. - * Another bullet point with **bold text**. This bullet point is also intentionally long to see - how the formatting is preserved when the text wraps onto multiple lines in the generated - documentation. - * Third bullet point with *italic text*. Similar to the previous points, this one is extended - to ensure that the wrapping and formatting are correctly applied in the output. - * Complex bullet point with **bold** and *italic* combined. This bullet point combines both - bold and italic formatting and is long enough to test the wrapping behavior in such cases. - * **Bold bullet point**: A bullet point that is entirely bolded. This point is also made - lengthy to observe how the bold formatting is maintained across wrapped lines. - * *Italic bullet point*: A bullet point that is entirely italicized. This final point is - extended to verify that italic formatting is correctly applied even when the text spans - multiple lines. - - :ivar prop: This property uses an enum with bullet point documentation. The enum documentation - includes various formatting styles to test rendering. The styles are: - - * Simple bullet point. This bullet point is going to be very long to test how text - wrapping is handled in bullet points within documentation comments. It should properly indent - the wrapped lines. - * Bullet point with **bold text**. This bullet point is also intentionally long to see how - the formatting is preserved when the text wraps onto multiple - * Bullet point with *italic text*. Similar to the previous points, this one is extended to - ensure that the wrapping and formatting are correctly applied in the output. - * Complex bullet point with **bold** and *italic* combined. This bullet point combines - both bold and italic formatting and is long enough to test the wrapping behavior in such cases. - * **Bold bullet point** - * *Italic bullet point*. Required. Known values are: "Simple", "Bold", and "Italic". - :vartype prop: str or ~specs.documentation.models.BulletPointsEnum - """ - - prop: Required[Union[str, "BulletPointsEnum"]] - """This property uses an enum with bullet point documentation. The enum documentation includes - various formatting styles to test rendering. The styles are: - - * Simple bullet point. This bullet point is going to be very long to test how text - wrapping is handled in bullet points within documentation comments. It should properly indent - the wrapped lines. - * Bullet point with **bold text**. This bullet point is also intentionally long to see how - the formatting is preserved when the text wraps onto multiple - * Bullet point with *italic text*. Similar to the previous points, this one is extended to - ensure that the wrapping and formatting are correctly applied in the output. - * Complex bullet point with **bold** and *italic* combined. This bullet point combines - both bold and italic formatting and is long enough to test the wrapping behavior in such cases. - * **Bold bullet point** - * *Italic bullet point*. Required. Known values are: \"Simple\", \"Bold\", and \"Italic\".""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/types.py deleted file mode 100644 index 05e5587390c8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/types.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class Info(TypedDict, total=False): - """Info. - - :ivar desc: Required. - :vartype desc: str - """ - - desc: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/types.py deleted file mode 100644 index c28b9c11a435..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-array/typetest/array/types.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class InnerModel(TypedDict, total=False): - """Array inner model. - - :ivar property: Required string property. Required. - :vartype property: str - :ivar children: - :vartype children: list[~typetest.array.models.InnerModel] - """ - - property: Required[str] - """Required string property. Required.""" - children: list["InnerModel"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/types.py deleted file mode 100644 index 6427fa5aface..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-dictionary/typetest/dictionary/types.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class InnerModel(TypedDict, total=False): - """Dictionary inner model. - - :ivar property: Required string property. Required. - :vartype property: str - :ivar children: - :vartype children: dict[str, ~typetest.dictionary.models.InnerModel] - """ - - property: Required[str] - """Required string property. Required.""" - children: dict[str, "InnerModel"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_unions.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_unions.py deleted file mode 100644 index 04525bdc89cb..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_unions.py +++ /dev/null @@ -1,10 +0,0 @@ -# coding=utf-8 - -from typing import TYPE_CHECKING, Union - -if TYPE_CHECKING: - from . import models as _models -PetWithEnvelope = Union["_models.Cat", "_models.Dog"] -PetWithCustomNames = Union["_models.Cat", "_models.Dog"] -PetInline = Union["_models.Cat", "_models.Dog"] -PetInlineWithCustomDiscriminator = Union["_models.Cat", "_models.Dog"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py index b208fb11fbc2..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py @@ -5,6 +5,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/types.py deleted file mode 100644 index 5a37a3833320..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/types.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class Cat(TypedDict, total=False): - """Cat. - - :ivar name: Required. - :vartype name: str - :ivar meow: Required. - :vartype meow: bool - """ - - name: Required[str] - """Required.""" - meow: Required[bool] - """Required.""" - - -class Dog(TypedDict, total=False): - """Dog. - - :ivar name: Required. - :vartype name: str - :ivar bark: Required. - :vartype bark: bool - """ - - name: Required[str] - """Required.""" - bark: Required[bool] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/types.py deleted file mode 100644 index 1b65929ee31f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-empty/typetest/model/empty/types.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding=utf-8 - -from typing_extensions import TypedDict - - -class EmptyInput(TypedDict, total=False): - """Empty model used in operation parameters.""" - - -class EmptyInputOutput(TypedDict, total=False): - """Empty model used in both parameter and return type.""" - - -class EmptyOutput(TypedDict, total=False): - """Empty model used in operation return type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/types.py deleted file mode 100644 index 3f031d19c0ee..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/types.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - -from .models._enums import DogKind, SnakeKind - - -class Cobra(TypedDict, total=False): - """Cobra model. - - :ivar length: Length of the snake. Required. - :vartype length: int - :ivar kind: discriminator property. Required. Species cobra. - :vartype kind: str or ~typetest.model.enumdiscriminator.models.COBRA - """ - - length: Required[int] - """Length of the snake. Required.""" - kind: Required[Literal[SnakeKind.COBRA]] - """discriminator property. Required. Species cobra.""" - - -class Golden(TypedDict, total=False): - """Golden dog model. - - :ivar weight: Weight of the dog. Required. - :vartype weight: int - :ivar kind: discriminator property. Required. Species golden. - :vartype kind: str or ~typetest.model.enumdiscriminator.models.GOLDEN - """ - - weight: Required[int] - """Weight of the dog. Required.""" - kind: Required[Literal[DogKind.GOLDEN]] - """discriminator property. Required. Species golden.""" - - -Snake = Union[Cobra] -Dog = Union[Golden] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/types.py deleted file mode 100644 index 92df64719526..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/types.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding=utf-8 - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class GoblinShark(TypedDict, total=False): - """The third level model GoblinShark in polymorphic multiple levels inheritance. - - :ivar age: Required. - :vartype age: int - :ivar kind: Required. Default value is "shark". - :vartype kind: str - :ivar sharktype: Required. Default value is "goblin". - :vartype sharktype: str - """ - - age: Required[int] - """Required.""" - kind: Required[Literal["shark"]] - """Required. Default value is \"shark\".""" - sharktype: Required[Literal["goblin"]] - """Required. Default value is \"goblin\".""" - - -class Salmon(TypedDict, total=False): - """The second level model in polymorphic multiple levels inheritance which contains references to - other polymorphic instances. - - :ivar age: Required. - :vartype age: int - :ivar kind: Required. Default value is "salmon". - :vartype kind: str - :ivar friends: - :vartype friends: list[~typetest.model.nesteddiscriminator.models.Fish] - :ivar hate: - :vartype hate: dict[str, ~typetest.model.nesteddiscriminator.models.Fish] - :ivar partner: - :vartype partner: ~typetest.model.nesteddiscriminator.models.Fish - """ - - age: Required[int] - """Required.""" - kind: Required[Literal["salmon"]] - """Required. Default value is \"salmon\".""" - friends: list["Fish"] - hate: dict[str, "Fish"] - partner: "Fish" - - -class SawShark(TypedDict, total=False): - """The third level model SawShark in polymorphic multiple levels inheritance. - - :ivar age: Required. - :vartype age: int - :ivar kind: Required. Default value is "shark". - :vartype kind: str - :ivar sharktype: Required. Default value is "saw". - :vartype sharktype: str - """ - - age: Required[int] - """Required.""" - kind: Required[Literal["shark"]] - """Required. Default value is \"shark\".""" - sharktype: Required[Literal["saw"]] - """Required. Default value is \"saw\".""" - - -Shark = Union[GoblinShark, SawShark] -Fish = Union[Salmon, Shark] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/CHANGELOG.md deleted file mode 100644 index b957b2575b48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release History - -## 1.0.0b1 (1970-01-01) - -### Other Changes - - - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/MANIFEST.in b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/MANIFEST.in deleted file mode 100644 index 1f779fa3398b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include *.md -include LICENSE -include typetest/model/notdiscriminated/typeddict/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include typetest/__init__.py -include typetest/model/__init__.py -include typetest/model/notdiscriminated/__init__.py diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/pyproject.toml b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/pyproject.toml deleted file mode 100644 index 1b1ea5f5c657..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/pyproject.toml +++ /dev/null @@ -1,51 +0,0 @@ - -[build-system] -requires = ["setuptools>=77.0.3", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "typetest-model-notdiscriminated-typeddict" -authors = [ - { name = "" }, -] -description = " Typetest Model Notdiscriminated Typeddict Client Library for Python" -license = "MIT" -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", -] -requires-python = ">=3.10" - -dependencies = [ - "isodate>=0.6.1", - "corehttp[requests]>=1.0.0b6", - "typing-extensions>=4.6.0", -] -dynamic = [ -"version", "readme" -] - -[tool.setuptools.dynamic] -version = {attr = "typetest.model.notdiscriminated.typeddict._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} - -[tool.setuptools.packages.find] -exclude = [ - "tests*", - "generated_tests*", - "samples*", - "generated_samples*", - "doc*", - "typetest", - "typetest.model", - "typetest.model.notdiscriminated", -] - -[tool.setuptools.package-data] -pytyped = ["py.typed"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/__init__.py deleted file mode 100644 index edfd0d3596ce..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import NotDiscriminatedClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "NotDiscriminatedClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_client.py deleted file mode 100644 index 95a446200a64..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_client.py +++ /dev/null @@ -1,86 +0,0 @@ -# coding=utf-8 - -from copy import deepcopy -import sys -from typing import Any - -from corehttp.rest import HttpRequest, HttpResponse -from corehttp.runtime import PipelineClient, policies - -from ._configuration import NotDiscriminatedClientConfiguration -from ._operations import _NotDiscriminatedClientOperationsMixin -from ._utils.serialization import Deserializer, Serializer - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class NotDiscriminatedClient( - _NotDiscriminatedClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """Illustrates not-discriminated inheritance model. - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = NotDiscriminatedClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.retry_policy, - self._config.authentication_policy, - self._config.logging_policy, - ] - self._client: PipelineClient = PipelineClient(endpoint=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from corehttp.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~corehttp.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~corehttp.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_configuration.py deleted file mode 100644 index 2818b26922a9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_configuration.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 - -from typing import Any - -from corehttp.runtime import policies - -from ._version import VERSION - - -class NotDiscriminatedClientConfiguration: - """Configuration for NotDiscriminatedClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-notdiscriminated-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/__init__.py deleted file mode 100644 index b6130d596f24..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _NotDiscriminatedClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_operations.py deleted file mode 100644 index 694795b1e03e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_operations.py +++ /dev/null @@ -1,347 +0,0 @@ -# coding=utf-8 -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from corehttp.rest import HttpRequest, HttpResponse -from corehttp.runtime import PipelineClient -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.utils import case_insensitive_dict - -from .. import models as _models, types -from .._configuration import NotDiscriminatedClientConfiguration -from .._utils.model_base import SdkJSONEncoder, _deserialize -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_not_discriminated_post_valid_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/type/model/inheritance/not-discriminated/valid" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_not_discriminated_get_valid_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/not-discriminated/valid" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_not_discriminated_put_valid_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/not-discriminated/valid" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -class _NotDiscriminatedClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], NotDiscriminatedClientConfiguration] -): - - @overload - def post_valid(self, input: _models.Siamese, *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def post_valid(self, input: types.Siamese, *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.types.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def post_valid(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def post_valid( # pylint: disable=inconsistent-return-statements - self, input: Union[_models.Siamese, types.Siamese, IO[bytes]], **kwargs: Any - ) -> None: - """post_valid. - - :param input: Is either a Siamese type or a IO[bytes] type. Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese or - ~typetest.model.notdiscriminated.typeddict.types.Siamese or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_not_discriminated_post_valid_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - def get_valid(self, **kwargs: Any) -> _models.Siamese: - """get_valid. - - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Siamese] = kwargs.pop("cls", None) - - _request = build_not_discriminated_get_valid_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Siamese, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put_valid( - self, input: _models.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def put_valid( - self, input: types.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.types.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def put_valid(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def put_valid(self, input: Union[_models.Siamese, types.Siamese, IO[bytes]], **kwargs: Any) -> _models.Siamese: - """put_valid. - - :param input: Is either a Siamese type or a IO[bytes] type. Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese or - ~typetest.model.notdiscriminated.typeddict.types.Siamese or IO[bytes] - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Siamese] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_not_discriminated_put_valid_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Siamese, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_operations/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/model_base.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/model_base.py deleted file mode 100644 index 99877baf4b2f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/model_base.py +++ /dev/null @@ -1,1731 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# pylint: disable=protected-access, broad-except - -import copy -import calendar -import decimal -import functools -import sys -import logging -import base64 -import re -import typing -import enum -import email.utils -from datetime import datetime, date, time, timedelta, timezone -from json import JSONEncoder -import xml.etree.ElementTree as ET -from collections.abc import MutableMapping -import isodate -from corehttp.exceptions import DeserializationError -from corehttp.utils import CaseInsensitiveEnumMeta -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.serialization import _Null - -from corehttp.rest import HttpResponse - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_LOGGER = logging.getLogger(__name__) - -__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] - -TZ_UTC = timezone.utc -_T = typing.TypeVar("_T") -_NONE_TYPE = type(None) - - -def _timedelta_as_isostr(td: timedelta) -> str: - """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' - - Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython - - :param timedelta td: The timedelta to convert - :rtype: str - :return: ISO8601 version of this timedelta - """ - - # Split seconds to larger units - seconds = td.total_seconds() - minutes, seconds = divmod(seconds, 60) - hours, minutes = divmod(minutes, 60) - days, hours = divmod(hours, 24) - - days, hours, minutes = list(map(int, (days, hours, minutes))) - seconds = round(seconds, 6) - - # Build date - date_str = "" - if days: - date_str = "%sD" % days - - if hours or minutes or seconds: - # Build time - time_str = "T" - - # Hours - bigger_exists = date_str or hours - if bigger_exists: - time_str += "{:02}H".format(hours) - - # Minutes - bigger_exists = bigger_exists or minutes - if bigger_exists: - time_str += "{:02}M".format(minutes) - - # Seconds - try: - if seconds.is_integer(): - seconds_string = "{:02}".format(int(seconds)) - else: - # 9 chars long w/ leading 0, 6 digits after decimal - seconds_string = "%09.6f" % seconds - # Remove trailing zeros - seconds_string = seconds_string.rstrip("0") - except AttributeError: # int.is_integer() raises - seconds_string = "{:02}".format(seconds) - - time_str += "{}S".format(seconds_string) - else: - time_str = "" - - return "P" + date_str + time_str - - -def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: - encoded = base64.b64encode(o).decode() - if format == "base64url": - return encoded.strip("=").replace("+", "-").replace("/", "_") - return encoded - - -def _serialize_datetime(o, format: typing.Optional[str] = None): - if hasattr(o, "year") and hasattr(o, "hour"): - if format == "rfc7231": - return email.utils.format_datetime(o, usegmt=True) - if format == "unix-timestamp": - return int(calendar.timegm(o.utctimetuple())) - - # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) - if not o.tzinfo: - iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() - else: - iso_formatted = o.astimezone(TZ_UTC).isoformat() - # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) - return iso_formatted.replace("+00:00", "Z") - # Next try datetime.date or datetime.time - return o.isoformat() - - -def _is_readonly(p): - try: - return p._visibility == ["read"] - except AttributeError: - return False - - -class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" - - def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): - super().__init__(*args, **kwargs) - self.exclude_readonly = exclude_readonly - self.format = format - - def default(self, o): # pylint: disable=too-many-return-statements - if _is_model(o): - if self.exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - return {k: v for k, v in o.items() if k not in readonly_props} - return dict(o.items()) - try: - return super(SdkJSONEncoder, self).default(o) - except TypeError: - if isinstance(o, _Null): - return None - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, self.format) - try: - # First try datetime.datetime - return _serialize_datetime(o, self.format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return super(SdkJSONEncoder, self).default(o) - - -_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") -_VALID_RFC7231 = re.compile( - r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" - r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" -) - -_ARRAY_ENCODE_MAPPING = { - "pipeDelimited": "|", - "spaceDelimited": " ", - "commaDelimited": ",", - "newlineDelimited": "\n", -} - - -def _deserialize_array_encoded(delimit: str, attr): - if isinstance(attr, str): - if attr == "": - return [] - return attr.split(delimit) - return attr - - -def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - attr = attr.upper() - match = _VALID_DATE.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - return date_obj # type: ignore[no-any-return] - - -def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize RFC7231 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - match = _VALID_RFC7231.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - return email.utils.parsedate_to_datetime(attr) - - -def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: - """Deserialize unix timestamp into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - return datetime.fromtimestamp(attr, TZ_UTC) - - -def _deserialize_date(attr: typing.Union[str, date]) -> date: - """Deserialize ISO-8601 formatted string into Date object. - :param str attr: response string to be deserialized. - :rtype: date - :returns: The date object from that input - """ - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - if isinstance(attr, date): - return attr - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore - - -def _deserialize_time(attr: typing.Union[str, time]) -> time: - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :returns: The time object from that input - """ - if isinstance(attr, time): - return attr - return isodate.parse_time(attr) # type: ignore[no-any-return] - - -def _deserialize_bytes(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - return bytes(base64.b64decode(attr)) - - -def _deserialize_bytes_base64(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return bytes(base64.b64decode(encoded)) - - -def _deserialize_duration(attr): - if isinstance(attr, timedelta): - return attr - return isodate.parse_duration(attr) - - -def _deserialize_decimal(attr): - if isinstance(attr, decimal.Decimal): - return attr - return decimal.Decimal(str(attr)) - - -def _deserialize_int_as_str(attr): - if isinstance(attr, int): - return attr - return int(attr) - - -_DESERIALIZE_MAPPING = { - datetime: _deserialize_datetime, - date: _deserialize_date, - time: _deserialize_time, - bytes: _deserialize_bytes, - bytearray: _deserialize_bytes, - timedelta: _deserialize_duration, - typing.Any: lambda x: x, - decimal.Decimal: _deserialize_decimal, -} - -_DESERIALIZE_MAPPING_WITHFORMAT = { - "rfc3339": _deserialize_datetime, - "rfc7231": _deserialize_datetime_rfc7231, - "unix-timestamp": _deserialize_datetime_unix_timestamp, - "base64": _deserialize_bytes, - "base64url": _deserialize_bytes_base64, -} - - -def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): - if annotation is int and rf and rf._format == "str": - return _deserialize_int_as_str - if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: - return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) - if rf and rf._format: - return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) - return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore - - -def _get_type_alias_type(module_name: str, alias_name: str): - types = { - k: v - for k, v in sys.modules[module_name].__dict__.items() - if isinstance(v, typing._GenericAlias) # type: ignore - } - if alias_name not in types: - return alias_name - return types[alias_name] - - -def _get_model(module_name: str, model_name: str): - models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} - module_end = module_name.rsplit(".", 1)[0] - models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) - if isinstance(model_name, str): - model_name = model_name.split(".")[-1] - if model_name not in models: - return model_name - return models[model_name] - - -_UNSET = object() - - -class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: dict[str, typing.Any]) -> None: - self._data = data - - def __contains__(self, key: typing.Any) -> bool: - return key in self._data - - def __getitem__(self, key: str) -> typing.Any: - # If this key has been deserialized (for mutable types), we need to handle serialization - if hasattr(self, "_attr_to_rest_field"): - cache_attr = f"_deserialized_{key}" - if hasattr(self, cache_attr): - rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) - if rf: - value = self._data.get(key) - if isinstance(value, (dict, list, set)): - # For mutable types, serialize and return - # But also update _data with serialized form and clear flag - # so mutations via this returned value affect _data - serialized = _serialize(value, rf._format) - # If serialized form is same type (no transformation needed), - # return _data directly so mutations work - if isinstance(serialized, type(value)) and serialized == value: - return self._data.get(key) - # Otherwise return serialized copy and clear flag - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - # Store serialized form back - self._data[key] = serialized - return serialized - return self._data.__getitem__(key) - - def __setitem__(self, key: str, value: typing.Any) -> None: - # Clear any cached deserialized value when setting through dictionary access - cache_attr = f"_deserialized_{key}" - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - self._data.__setitem__(key, value) - - def __delitem__(self, key: str) -> None: - self._data.__delitem__(key) - - def __iter__(self) -> typing.Iterator[typing.Any]: - return self._data.__iter__() - - def __len__(self) -> int: - return self._data.__len__() - - def __ne__(self, other: typing.Any) -> bool: - return not self.__eq__(other) - - def keys(self) -> typing.KeysView[str]: - """ - :returns: a set-like object providing a view on D's keys - :rtype: ~typing.KeysView - """ - return self._data.keys() - - def values(self) -> typing.ValuesView[typing.Any]: - """ - :returns: an object providing a view on D's values - :rtype: ~typing.ValuesView - """ - return self._data.values() - - def items(self) -> typing.ItemsView[str, typing.Any]: - """ - :returns: set-like object providing a view on D's items - :rtype: ~typing.ItemsView - """ - return self._data.items() - - def get(self, key: str, default: typing.Any = None) -> typing.Any: - """ - Get the value for key if key is in the dictionary, else default. - :param str key: The key to look up. - :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. - :rtype: any - """ - try: - return self[key] - except KeyError: - return default - - @typing.overload - def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ - - @typing.overload - def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs - - @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Removes specified key and return the corresponding value. - :param str key: The key to pop. - :param any default: The value to return if key is not in the dictionary - :returns: The value corresponding to the key. - :rtype: any - :raises KeyError: If key is not found and default is not given. - """ - if default is _UNSET: - return self._data.pop(key) - return self._data.pop(key, default) - - def popitem(self) -> tuple[str, typing.Any]: - """ - Removes and returns some (key, value) pair - :returns: The (key, value) pair. - :rtype: tuple - :raises KeyError: if D is empty. - """ - return self._data.popitem() - - def clear(self) -> None: - """ - Remove all items from D. - """ - self._data.clear() - - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ - """ - Updates D from mapping/iterable E and F. - :param any args: Either a mapping object or an iterable of key-value pairs. - """ - self._data.update(*args, **kwargs) - - @typing.overload - def setdefault(self, key: str, default: None = None) -> None: ... - - @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Same as calling D.get(k, d), and setting D[k]=d if k not found - :param str key: The key to look up. - :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. - :rtype: any - """ - if default is _UNSET: - return self._data.setdefault(key) - return self._data.setdefault(key, default) - - def __eq__(self, other: typing.Any) -> bool: - if isinstance(other, _MyMutableMapping): - return self._data == other._data - try: - other_model = self.__class__(other) - except Exception: - return False - return self._data == other_model._data - - def __repr__(self) -> str: - return str(self._data) - - -def _is_model(obj: typing.Any) -> bool: - return getattr(obj, "_is_model", False) - - -def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements - if isinstance(o, list): - if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): - return _ARRAY_ENCODE_MAPPING[format].join(o) - return [_serialize(x, format) for x in o] - if isinstance(o, dict): - return {k: _serialize(v, format) for k, v in o.items()} - if isinstance(o, set): - return {_serialize(x, format) for x in o} - if isinstance(o, tuple): - return tuple(_serialize(x, format) for x in o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, format) - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, enum.Enum): - return o.value - if isinstance(o, int): - if format == "str": - return str(o) - return o - try: - # First try datetime.datetime - return _serialize_datetime(o, format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return o - - -def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: - try: - return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) - except StopIteration: - return None - - -def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: - if not rf: - return _serialize(value, None) - if rf._is_multipart_file_input: - return value - if rf._is_model: - return _deserialize(rf._type, value) - if isinstance(value, ET.Element): - value = _deserialize(rf._type, value) - return _serialize(value, rf._format) - - -# ============================================================================ -# Fast-path scalar deserializer functions for rest_field(deserializer=...) -# These are referenced from rest_field declarations to bypass the generic -# _deserialize -> _deserialize_with_callable chain. -# Only simple/primitive types — no models or container types. -# ============================================================================ - - -def _xml_deser_str(value): - if isinstance(value, ET.Element): - return value.text or "" - return str(value) if value is not None else None - - -def _xml_deser_int(value): - if isinstance(value, ET.Element): - return int(value.text) if value.text else None - return int(value) if value is not None else None - - -def _xml_deser_float(value): - if isinstance(value, ET.Element): - return float(value.text) if value.text else None - return float(value) if value is not None else None - - -def _xml_deser_bool(value): - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - if text in (True, False): - return text - return text.lower() == "true" - - -# pylint: disable=docstring-missing-param -def _xml_deser_bytes(value): - """Deserialize bytes from XML (base64).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes(text) - - -def _xml_deser_bytes_base64url(value): - """Deserialize bytes from XML (base64url).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes_base64(text) - - -def _xml_deser_datetime(value): - """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime(text) - - -def _xml_deser_datetime_rfc7231(value): - """Deserialize a datetime from XML (RFC7231 format).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_rfc7231(text) - - -def _xml_deser_datetime_unix_timestamp(value): - """Deserialize a datetime from XML (Unix timestamp).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_unix_timestamp(float(text)) - - -def _xml_deser_date(value): - """Deserialize a date from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_date(text) - - -def _xml_deser_time(value): - """Deserialize a time from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_time(text) - - -def _xml_deser_duration(value): - """Deserialize a timedelta from XML (ISO 8601 duration).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_duration(text) - - -def _xml_deser_decimal(value): - """Deserialize a Decimal from XML.""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_decimal(text) - - -def _xml_deser_enum_or_str(enum_cls, value): - """Deserialize a Union[EnumType, str] from XML.""" - text = value.text if isinstance(value, ET.Element) else value - if text is None: - return None - try: - return enum_cls(text) - except ValueError: - return text - - -def _extract_xml_model_type(rf_type): - """Extract the concrete Model class from a resolved rf._type partial chain. - - Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` - wrappers. Only handles Model and Optional[Model] — other composite - types (List, Dict, Union, etc.) return None and fall through to the - generic ``_deserialize`` path at runtime. - """ - if rf_type is None: - return None - if isinstance(rf_type, type) and _is_model(rf_type): - return rf_type - if not isinstance(rf_type, functools.partial): - return None - func = rf_type.func - args = rf_type.args - if func is _deserialize_with_optional and args: - return _extract_xml_model_type(args[0]) - if func is _deserialize_model and args: - cls = args[0] - return cls if isinstance(cls, type) and _is_model(cls) else None - return None - - -def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable - cls, attr_to_rest_field: dict -) -> list: - """Build a precomputed XML field plan for fast _init_from_xml iteration. - - Called once per model class in __new__. Returns a list of tuples: - (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) - - kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text - - For Model and Optional[Model] fields that lack a scalar - ``_deserializer``, this function precomputes the Model class as the - deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` - directly instead of going through the expensive - ``_get_deserialize_callable_from_annotation`` chain at runtime. - """ - model_meta = getattr(cls, "_xml", {}) - model_ns = model_meta.get("ns") or model_meta.get("namespace") - plan = [] - - for rf in attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - deser = rf._deserializer - - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - is_optional = rf._is_optional - - # For Model / Optional[Model] fields without a scalar deserializer, - # precompute the Model class as the deserializer. - if deser is None and rf._type is not None: - model_cls = _extract_xml_model_type(rf._type) - if model_cls is not None: - deser = model_cls - - if prop_meta.get("attribute", False): - plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) - elif prop_meta.get("unwrapped", False): - items_name = prop_meta.get("itemsName") - if items_name: - items_ns = prop_meta.get("itemsNs") - if items_ns is not None: - xml_ns = items_ns - if xml_ns: - items_name = "{" + xml_ns + "}" + items_name - else: - items_name = xml_name - plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) - elif prop_meta.get("text", False): - plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) - else: - plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) - - return plan - - -# pylint: enable=docstring-missing-param -class Model(_MyMutableMapping): - _is_model = True - # label whether current class's _attr_to_rest_field has been calculated - # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: set[str] = set() - - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: - class_name = self.__class__.__name__ - if len(args) > 1: - raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass: dict[str, typing.Any] = {} - if args: - if isinstance(args[0], ET.Element): - dict_to_pass.update(self._init_from_xml(args[0])) - else: - dict_to_pass.update( - {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} - ) - else: - non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] - if non_attr_kwargs: - # actual type errors only throw the first wrong keyword arg they see, so following that. - raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") - dict_to_pass.update( - { - self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) - for k, v in kwargs.items() - if v is not None - } - ) - # Apply client default values for fields the caller didn't set so that - # defaults are part of `_data` and therefore included during serialization. - for rf in self._attr_to_rest_field.values(): - if rf._default is _UNSET: - continue - if rf._rest_name in dict_to_pass: - continue - dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) - super().__init__(dict_to_pass) - - def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements - self, element: ET.Element - ) -> dict[str, typing.Any]: - """Deserialize an XML element into a dict mapping rest field names to values. - - :param ET.Element element: The XML element to deserialize from. - :returns: A dictionary of rest_name to deserialized value pairs. - :rtype: dict - """ - result: dict[str, typing.Any] = {} - existed_attr_keys: list[str] = [] - - field_plan = getattr(self, "_xml_field_plan", None) - if field_plan: - for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: - if kind == 0: # wrapped element (most common) - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(item) - else: - result[rest_name] = _deserialize(rf_type, item) - elif kind == 1: # attribute - attr_val = element.get(xml_name) - if attr_val is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(attr_val) - else: - result[rest_name] = attr_val - elif kind == 2: # unwrapped array - items = element.findall(items_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(items_name) - if deser: - result[rest_name] = deser(items) - else: - result[rest_name] = _deserialize(rf_type, items) - elif not is_optional: - existed_attr_keys.append(items_name) - result[rest_name] = [] - elif kind == 3: # text - if element.text is not None: - if deser: - result[rest_name] = deser(element.text) - else: - result[rest_name] = element.text - else: - model_meta = getattr(self, "_xml", {}) - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in element: - if e.tag not in existed_attr_keys: - result[e.tag] = _convert_element(e) - - return result - - def copy(self) -> "Model": - return Model(self.__dict__) - - 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' - mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property - k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") - } - annotations = { - k: v - for mro_class in mros - 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__ - if not rf._type: - rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) - if not rf._rest_name_input: - rf._rest_name_input = attr - cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) - # Build XML field plan for fast _init_from_xml (only for XML models) - if getattr(cls, "_xml", None): - cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) - cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - - return super().__new__(cls) - - def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: - for base in cls.__bases__: - if hasattr(base, "__mapping__"): - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore - - @classmethod - def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: - for v in cls.__dict__.values(): - if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: - return v - return None - - @classmethod - def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): - return cls(data) - discriminator = cls._get_discriminator(exist_discriminators) - if discriminator is None: - return cls(data) - exist_discriminators.append(discriminator._rest_name) - if isinstance(data, ET.Element): - model_meta = getattr(cls, "_xml", {}) - prop_meta = getattr(discriminator, "_xml", {}) - xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - if data.get(xml_name) is not None: - discriminator_value = data.get(xml_name) - else: - 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 - return mapped_cls._deserialize(data, exist_discriminators) - - def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: - """Return a dict that can be turned into json using json.dump. - - :keyword bool exclude_readonly: Whether to remove the readonly properties. - :returns: A dict JSON compatible object - :rtype: dict - """ - - result = {} - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] - for k, v in self.items(): - if exclude_readonly and k in readonly_props: # pyright: ignore - continue - is_multipart_file_input = False - try: - is_multipart_file_input = next( - rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k - )._is_multipart_file_input - except StopIteration: - pass - result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) - return result - - @staticmethod - def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: - if v is None or isinstance(v, _Null): - return None - if isinstance(v, (list, tuple, set)): - return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) - if isinstance(v, dict): - return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} - return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v - - -def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - - -def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - -def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - - -def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj: dict[typing.Any, typing.Any], -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = {child.tag: child for child in obj} - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - - -def _deserialize_multiple_sequence( - entry_deserializers: list[typing.Optional[typing.Callable]], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) - - -def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: - return ( - isinstance(deserializer, functools.partial) - and isinstance(deserializer.args[0], functools.partial) - and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable - ) - - -def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = list(obj) - - # encoded string may be deserialized to sequence - if isinstance(obj, str) and isinstance(deserializer, functools.partial): - # for list[str] - if _is_array_encoded_deserializer(deserializer): - return deserializer(obj) - - # for list[Union[...]] - if isinstance(deserializer.args[0], list): - for sub_deserializer in deserializer.args[0]: - if _is_array_encoded_deserializer(sub_deserializer): - return sub_deserializer(obj) - - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - -def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: - return sorted( - types, - key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), - ) - - -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches - annotation: typing.Any, - module: typing.Optional[str], - rf: typing.Optional["_RestField"] = None, -) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - if not annotation: - return None - - # is it a type alias? - if isinstance(annotation, str): - if module is not None: - annotation = _get_type_alias_type(module, annotation) - - # is it a forward ref / in quotes? - if isinstance(annotation, (str, typing.ForwardRef)): - try: - model_name = annotation.__forward_arg__ # type: ignore - except AttributeError: - model_name = annotation - if module is not None: - annotation = _get_model(module, model_name) # type: ignore - - try: - if module and _is_model(annotation): - if rf: - rf._is_model = True - - return functools.partial(_deserialize_model, annotation) # pyright: ignore - except Exception: - pass - - # is it a literal? - try: - if annotation.__origin__ is typing.Literal: # pyright: ignore - return None - except AttributeError: - pass - - # is it optional? - try: - if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore - if rf: - rf._is_optional = True - if len(annotation.__args__) <= 2: # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) - # the type is Optional[Union[...]], we need to remove the None type from the Union - annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore - return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) - except AttributeError: - pass - - # is it union? - if getattr(annotation, "__origin__", None) is typing.Union: - # initial ordering is we make `string` the last deserialization option, because it is often them most generic - deserializers = [ - _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in _sorted_annotations(annotation.__args__) # pyright: ignore - ] - - return functools.partial(_deserialize_with_union, deserializers) - - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() == "dict": - value_deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[1], module, rf # pyright: ignore - ) - - return functools.partial( - _deserialize_dict, - value_deserializer, - module, - ) - except (AttributeError, IndexError): - pass - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: - if len(annotation.__args__) > 1: # pyright: ignore - entry_deserializers = [ - _get_deserialize_callable_from_annotation(dt, module, rf) - for dt in annotation.__args__ # pyright: ignore - ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) - deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[0], module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_sequence, deserializer, module) - except (TypeError, IndexError, AttributeError, SyntaxError): - pass - - def _deserialize_default( - deserializer, - obj, - ): - if obj is None: - return obj - try: - return _deserialize_with_callable(deserializer, obj) - except Exception: - pass - return obj - - if get_deserializer(annotation, rf): - return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) - - return functools.partial(_deserialize_default, annotation) - - -def _deserialize_with_callable( - deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], - value: typing.Any, -): # pylint: disable=too-many-return-statements - try: - if value is None or isinstance(value, _Null): - return None - if isinstance(value, ET.Element): - if deserializer is str: - return value.text or "" - if deserializer is int: - return int(value.text) if value.text else None - if deserializer is float: - return float(value.text) if value.text else None - if deserializer is bool: - return value.text == "true" if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): - return deserializer(value.text) if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): - return deserializer(value.text) if value.text else None - if deserializer is None: - return value - if deserializer in [int, float, bool]: - return deserializer(value) - if isinstance(deserializer, CaseInsensitiveEnumMeta): - try: - return deserializer(value.text if isinstance(value, ET.Element) else value) - except ValueError: - # for unknown value, return raw value - return value.text if isinstance(value, ET.Element) else value - if isinstance(deserializer, type) and issubclass(deserializer, Model): - return deserializer._deserialize(value, []) - return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) - except Exception as e: - raise DeserializationError() from e - - -def _deserialize( - deserializer: typing.Any, - value: typing.Any, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - if isinstance(value, PipelineResponse): - value = value.http_response.json() - if rf is None and format: - rf = _RestField(format=format) - if not isinstance(deserializer, functools.partial): - deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) - return _deserialize_with_callable(deserializer, value) - - -def _failsafe_deserialize( - deserializer: typing.Any, - response: HttpResponse, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - try: - return _deserialize(deserializer, response.json(), module, rf, format) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -def _failsafe_deserialize_xml( - deserializer: typing.Any, - response: HttpResponse, -) -> typing.Any: - try: - return _deserialize_xml(deserializer, response.text()) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -# pylint: disable=too-many-instance-attributes -class _RestField: - def __init__( - self, - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - is_discriminator: bool = False, - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, - ): - self._type = type - self._rest_name_input = name - self._module: typing.Optional[str] = None - self._is_discriminator = is_discriminator - self._visibility = visibility - self._is_model = False - self._is_optional = False - self._default = default - self._format = format - self._is_multipart_file_input = is_multipart_file_input - self._xml = xml if xml is not None else {} - self._deserializer = deserializer - - @property - def _class_type(self) -> typing.Any: - result = getattr(self._type, "args", [None])[0] - # type may be wrapped by nested functools.partial so we need to check for that - if isinstance(result, functools.partial): - return getattr(result, "args", [None])[0] - return result - - @property - def _rest_name(self) -> str: - if self._rest_name_input is None: - raise ValueError("Rest name was never set") - return self._rest_name_input - - def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin - # by this point, type and rest_name will have a value bc we default - # them in __new__ of the Model class - # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name, _UNSET) - if item is _UNSET: - # Field not set by user; return the client default if one exists, otherwise None - return self._default if self._default is not _UNSET else None - if item is None: - return item - if self._is_model: - return item - - # For mutable types, we want mutations to directly affect _data - # Check if we've already deserialized this value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - # Return the value from _data directly (it's been deserialized in place) - return obj._data.get(self._rest_name) - - # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) - if self._deserializer: - deserialized = self._deserializer(item) - else: - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) - - # For mutable types, store the deserialized value back in _data - # so mutations directly affect _data - if isinstance(deserialized, (dict, list, set)): - obj._data[self._rest_name] = deserialized - object.__setattr__(obj, cache_attr, True) # Mark as deserialized - return deserialized - - return deserialized - - def __set__(self, obj: Model, value) -> None: - # Clear the cached deserialized object when setting a new value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - object.__delattr__(obj, cache_attr) - - if value is None: - # we want to wipe out entries if users set attr to None - try: - obj.__delitem__(self._rest_name) - except KeyError: - pass - return - if self._is_model: - if not _is_model(value): - value = _deserialize(self._type, value) - obj.__setitem__(self._rest_name, value) - return - obj.__setitem__(self._rest_name, _serialize(value, self._format)) - - def _get_deserialize_callable_from_annotation( - self, annotation: typing.Any - ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - return _get_deserialize_callable_from_annotation(annotation, self._module, self) - - -def rest_field( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, -) -> typing.Any: - return _RestField( - name=name, - type=type, - visibility=visibility, - default=default, - format=format, - is_multipart_file_input=is_multipart_file_input, - xml=xml, - deserializer=deserializer, - ) - - -def rest_discriminator( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) - - -def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: - """Serialize a model to XML. - - :param Model model: The model to serialize. - :param bool exclude_readonly: Whether to exclude readonly properties. - :returns: The XML representation of the model. - :rtype: str - """ - return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore - - -def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: - """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. - - :param dict meta: The metadata dictionary to extract namespace from. - :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. - :rtype: str or None - """ - ns = meta.get("ns") - if ns is None: - ns = meta.get("namespace") - return ns - - -def _resolve_xml_ns( - prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None -) -> typing.Optional[str]: - """Resolve XML namespace for a property, falling back to model namespace when appropriate. - - Checks the property metadata first; if no namespace is found and the model does not declare - an explicit prefix, falls back to the model-level namespace. - - :param dict prop_meta: The property metadata dictionary. - :param dict model_meta: The model metadata dictionary, used as fallback. - :returns: The resolved namespace string, or None. - :rtype: str or None - """ - ns = _get_xml_ns(prop_meta) - if ns is None and model_meta is not None and not model_meta.get("prefix"): - ns = _get_xml_ns(model_meta) - return ns - - -def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: - """Set an XML attribute on an element, handling namespace prefix registration. - - :param ET.Element element: The element to set the attribute on. - :param str name: The default attribute name (wire name). - :param any value: The attribute value. - :param dict prop_meta: The property metadata dictionary. - """ - xml_name = prop_meta.get("name", name) - _attr_ns = _get_xml_ns(prop_meta) - if _attr_ns: - _attr_prefix = prop_meta.get("prefix") - if _attr_prefix: - _safe_register_namespace(_attr_prefix, _attr_ns) - xml_name = "{" + _attr_ns + "}" + xml_name - element.set(xml_name, _get_primitive_type_value(value)) - - -def _get_element( - o: typing.Any, - exclude_readonly: bool = False, - parent_meta: typing.Optional[dict[str, typing.Any]] = None, - wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, list[ET.Element]]: - if _is_model(o): - model_meta = getattr(o, "_xml", {}) - - # if prop is a model, then use the prop element directly, else generate a wrapper of model - if wrapped_element is None: - # When serializing as an array item (parent_meta is set), check if the parent has an - # explicit itemsName. This ensures correct element names for unwrapped arrays (where - # the element tag is the property/items name, not the model type name). - _items_name = parent_meta.get("itemsName") if parent_meta is not None else None - element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) - _model_ns = _get_xml_ns(model_meta) - wrapped_element = _create_xml_element( - element_name, - model_meta.get("prefix"), - _model_ns, - ) - - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - - for k, v in o.items(): - # do not serialize readonly properties - if exclude_readonly and k in readonly_props: - continue - - prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) - if prop_rest_field: - prop_meta = getattr(prop_rest_field, "_xml").copy() - # use the wire name as xml name if no specific name is set - if prop_meta.get("name") is None: - prop_meta["name"] = k - else: - # additional properties will not have rest field, use the wire name as xml name - prop_meta = {"name": k} - - # Propagate model namespace to properties only for old-style "ns"-keyed models. - # DPG-generated models use the "namespace" key and explicitly declare namespace on - # each property that needs it, so propagation is intentionally skipped for them. - if prop_meta.get("ns") is None and model_meta.get("ns"): - prop_meta["ns"] = model_meta.get("ns") - prop_meta["prefix"] = model_meta.get("prefix") - - if prop_meta.get("unwrapped", False): - # unwrapped could only set on array - wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) - elif prop_meta.get("text", False): - # text could only set on primitive type - wrapped_element.text = _get_primitive_type_value(v) - elif prop_meta.get("attribute", False): - _set_xml_attribute(wrapped_element, k, v, prop_meta) - else: - # other wrapped prop element - wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) - return wrapped_element - if isinstance(o, list): - return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore - if isinstance(o, dict): - result = [] - _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None - for k, v in o.items(): - result.append( - _get_wrapped_element( - v, - exclude_readonly, - { - "name": k, - "ns": _dict_ns, - "prefix": parent_meta.get("prefix") if parent_meta else None, - }, - ) - ) - return result - - # primitive case need to create element based on parent_meta - if parent_meta: - _items_ns = parent_meta.get("itemsNs") - if _items_ns is None: - _items_ns = _get_xml_ns(parent_meta) - return _get_wrapped_element( - o, - exclude_readonly, - { - "name": parent_meta.get("itemsName", parent_meta.get("name")), - "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": _items_ns, - }, - ) - - raise ValueError("Could not serialize value into xml: " + o) - - -def _get_wrapped_element( - v: typing.Any, - exclude_readonly: bool, - meta: typing.Optional[dict[str, typing.Any]], -) -> ET.Element: - _meta_ns = _get_xml_ns(meta) if meta else None - wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns - ) - if isinstance(v, (dict, list)): - wrapped_element.extend(_get_element(v, exclude_readonly, meta)) - elif _is_model(v): - _get_element(v, exclude_readonly, meta, wrapped_element) - else: - wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element # type: ignore[no-any-return] - - -def _get_primitive_type_value(v) -> str: - if v is True: - return "true" - if v is False: - return "false" - if isinstance(v, _Null): - return "" - return str(v) - - -def _safe_register_namespace(prefix: str, ns: str) -> None: - """Register an XML namespace prefix, handling reserved prefix patterns. - - Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for - auto-generated prefixes, causing register_namespace to raise ValueError. - Falls back to directly registering in the internal namespace map. - - :param str prefix: The namespace prefix to register. - :param str ns: The namespace URI. - """ - try: - ET.register_namespace(prefix, ns) - except ValueError: - _ns_map = getattr(ET, "_namespace_map", None) - if _ns_map is not None: - _ns_map[ns] = prefix - - -def _create_xml_element( - tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None -) -> ET.Element: - if prefix and ns: - _safe_register_namespace(prefix, ns) - if ns: - return ET.Element("{" + ns + "}" + tag) - return ET.Element(tag) - - -def _deserialize_xml( - deserializer: typing.Any, - value: str, -) -> typing.Any: - element = ET.fromstring(value) # nosec - if _is_model(deserializer): - return deserializer._deserialize(element, []) - return _deserialize(deserializer, element) - - -def _convert_element(e: ET.Element): - # dict case - if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: dict[str, typing.Any] = {} - for child in e: - if dict_result.get(child.tag) is not None: - if isinstance(dict_result[child.tag], list): - dict_result[child.tag].append(_convert_element(child)) - else: - dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] - else: - dict_result[child.tag] = _convert_element(child) - dict_result.update(e.attrib) - return dict_result - # array case - if len(e) > 0: - array_result: list[typing.Any] = [] - for child in e: - array_result.append(_convert_element(child)) - return array_result - # primitive case - return e.text diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/serialization.py deleted file mode 100644 index 8e648e299998..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/serialization.py +++ /dev/null @@ -1,2060 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore - -from corehttp.exceptions import DeserializationError, SerializationError -from corehttp.serialization import NULL as CoreNull - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # Fast path for header deserialization: response_data is a plain str or None - # and target_obj is a simple scalar type. This avoids the expensive - # _unpack_content → _deserialize → _classify_target → deserialize_data chain. - if response_data is None: - return None - if target_obj == "str" and isinstance(response_data, str): - return response_data - if isinstance(response_data, str): - if target_obj == "int": - return int(response_data) - if target_obj == "bool": - if response_data in ("true", "1", "True"): - return True - if response_data in ("false", "0", "False"): - return False - return bool(response_data) - if target_obj == "rfc-1123": - return Deserializer.deserialize_rfc(response_data) - if target_obj == "bytearray": - return Deserializer.deserialize_bytearray(response_data) - - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/utils.py deleted file mode 100644 index 02aa2f816ea7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_utils/utils.py +++ /dev/null @@ -1,18 +0,0 @@ -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_version.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_version.py deleted file mode 100644 index 9f6458b8cdac..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/_version.py +++ /dev/null @@ -1,3 +0,0 @@ -# coding=utf-8 - -VERSION = "1.0.0b1" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/__init__.py deleted file mode 100644 index b6adbc2257da..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import NotDiscriminatedClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "NotDiscriminatedClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_client.py deleted file mode 100644 index 22d0a9c0f664..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_client.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding=utf-8 - -from copy import deepcopy -import sys -from typing import Any, Awaitable - -from corehttp.rest import AsyncHttpResponse, HttpRequest -from corehttp.runtime import AsyncPipelineClient, policies - -from .._utils.serialization import Deserializer, Serializer -from ._configuration import NotDiscriminatedClientConfiguration -from ._operations import _NotDiscriminatedClientOperationsMixin - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class NotDiscriminatedClient( - _NotDiscriminatedClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """Illustrates not-discriminated inheritance model. - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = NotDiscriminatedClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.retry_policy, - self._config.authentication_policy, - self._config.logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(endpoint=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from corehttp.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~corehttp.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~corehttp.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_configuration.py deleted file mode 100644 index eb0e4740d506..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_configuration.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 - -from typing import Any - -from corehttp.runtime import policies - -from .._version import VERSION - - -class NotDiscriminatedClientConfiguration: - """Configuration for NotDiscriminatedClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-notdiscriminated-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/__init__.py deleted file mode 100644 index b6130d596f24..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _NotDiscriminatedClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_operations.py deleted file mode 100644 index 5836e33e966a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_operations.py +++ /dev/null @@ -1,313 +0,0 @@ -# coding=utf-8 -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from corehttp.rest import AsyncHttpResponse, HttpRequest -from corehttp.runtime import AsyncPipelineClient -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.utils import case_insensitive_dict - -from ... import models as _models, types -from ..._operations._operations import ( - build_not_discriminated_get_valid_request, - build_not_discriminated_post_valid_request, - build_not_discriminated_put_valid_request, -) -from ..._utils.model_base import SdkJSONEncoder, _deserialize -from ..._utils.utils import ClientMixinABC -from .._configuration import NotDiscriminatedClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _NotDiscriminatedClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], NotDiscriminatedClientConfiguration] -): - - @overload - async def post_valid( - self, input: _models.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """post_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def post_valid(self, input: types.Siamese, *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.types.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def post_valid(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """post_valid. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def post_valid(self, input: Union[_models.Siamese, types.Siamese, IO[bytes]], **kwargs: Any) -> None: - """post_valid. - - :param input: Is either a Siamese type or a IO[bytes] type. Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese or - ~typetest.model.notdiscriminated.typeddict.types.Siamese or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_not_discriminated_post_valid_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def get_valid(self, **kwargs: Any) -> _models.Siamese: - """get_valid. - - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Siamese] = kwargs.pop("cls", None) - - _request = build_not_discriminated_get_valid_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Siamese, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put_valid( - self, input: _models.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def put_valid( - self, input: types.Siamese, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: ~typetest.model.notdiscriminated.typeddict.types.Siamese - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def put_valid( - self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def put_valid( - self, input: Union[_models.Siamese, types.Siamese, IO[bytes]], **kwargs: Any - ) -> _models.Siamese: - """put_valid. - - :param input: Is either a Siamese type or a IO[bytes] type. Required. - :type input: ~typetest.model.notdiscriminated.typeddict.models.Siamese or - ~typetest.model.notdiscriminated.typeddict.types.Siamese or IO[bytes] - :return: Siamese. The Siamese is compatible with MutableMapping - :rtype: ~typetest.model.notdiscriminated.typeddict.models.Siamese - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Siamese] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_not_discriminated_put_valid_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Siamese, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_operations/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/aio/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/__init__.py deleted file mode 100644 index 68ab5405c20c..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models import ( # type: ignore - Cat, - Pet, - Siamese, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Cat", - "Pet", - "Siamese", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_models.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_models.py deleted file mode 100644 index 838cd399fb66..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_models.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# pylint: disable=useless-super-delegation - -from typing import Any, Mapping, overload - -from .._utils.model_base import Model as _Model, rest_field - - -class Pet(_Model): - """This is base model for not-discriminated normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - """ - - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - name: str, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Cat(Pet): - """The second level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - """ - - age: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - name: str, - age: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Siamese(Cat): - """The third level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - :ivar smart: Required. - :vartype smart: bool - """ - - smart: bool = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - name: str, - age: int, - smart: bool, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/models/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/py.typed b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/types.py deleted file mode 100644 index 2fb2833b1615..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated-typeddict/typetest/model/notdiscriminated/typeddict/types.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class Pet(TypedDict, total=False): - """This is base model for not-discriminated normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Cat(Pet): - """The second level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - """ - - age: Required[int] - """Required.""" - - -class Siamese(Cat): - """The third level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - :ivar smart: Required. - :vartype smart: bool - """ - - smart: Required[bool] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/types.py deleted file mode 100644 index 2fb2833b1615..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/types.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class Pet(TypedDict, total=False): - """This is base model for not-discriminated normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Cat(Pet): - """The second level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - """ - - age: Required[int] - """Required.""" - - -class Siamese(Cat): - """The third level model in the normal multiple levels inheritance. - - :ivar name: Required. - :vartype name: str - :ivar age: Required. - :vartype age: int - :ivar smart: Required. - :vartype smart: bool - """ - - smart: Required[bool] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/types.py deleted file mode 100644 index 7f404c784a5a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-recursive/typetest/model/recursive/types.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class Element(TypedDict, total=False): - """element. - - :ivar extension: - :vartype extension: list[~typetest.model.recursive.models.Extension] - """ - - extension: list["Extension"] - - -class Extension(Element): - """extension. - - :ivar extension: - :vartype extension: list[~typetest.model.recursive.models.Extension] - :ivar level: Required. - :vartype level: int - """ - - level: Required[int] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/CHANGELOG.md deleted file mode 100644 index b957b2575b48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release History - -## 1.0.0b1 (1970-01-01) - -### Other Changes - - - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/MANIFEST.in b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/MANIFEST.in deleted file mode 100644 index f006a55bee75..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include *.md -include LICENSE -include typetest/model/singlediscriminator/typeddict/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include typetest/__init__.py -include typetest/model/__init__.py -include typetest/model/singlediscriminator/__init__.py diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/pyproject.toml b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/pyproject.toml deleted file mode 100644 index 61d710b12457..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/pyproject.toml +++ /dev/null @@ -1,51 +0,0 @@ - -[build-system] -requires = ["setuptools>=77.0.3", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "typetest-model-singlediscriminator-typeddict" -authors = [ - { name = "" }, -] -description = " Typetest Model Singlediscriminator Typeddict Client Library for Python" -license = "MIT" -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", -] -requires-python = ">=3.10" - -dependencies = [ - "isodate>=0.6.1", - "corehttp[requests]>=1.0.0b6", - "typing-extensions>=4.6.0", -] -dynamic = [ -"version", "readme" -] - -[tool.setuptools.dynamic] -version = {attr = "typetest.model.singlediscriminator.typeddict._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} - -[tool.setuptools.packages.find] -exclude = [ - "tests*", - "generated_tests*", - "samples*", - "generated_samples*", - "doc*", - "typetest", - "typetest.model", - "typetest.model.singlediscriminator", -] - -[tool.setuptools.package-data] -pytyped = ["py.typed"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/__init__.py deleted file mode 100644 index 584174329f00..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import SingleDiscriminatorClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SingleDiscriminatorClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_client.py deleted file mode 100644 index cdfef7009bc1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_client.py +++ /dev/null @@ -1,86 +0,0 @@ -# coding=utf-8 - -from copy import deepcopy -import sys -from typing import Any - -from corehttp.rest import HttpRequest, HttpResponse -from corehttp.runtime import PipelineClient, policies - -from ._configuration import SingleDiscriminatorClientConfiguration -from ._operations import _SingleDiscriminatorClientOperationsMixin -from ._utils.serialization import Deserializer, Serializer - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class SingleDiscriminatorClient( - _SingleDiscriminatorClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """Illustrates inheritance with single discriminator. - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = SingleDiscriminatorClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.retry_policy, - self._config.authentication_policy, - self._config.logging_policy, - ] - self._client: PipelineClient = PipelineClient(endpoint=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from corehttp.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~corehttp.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~corehttp.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_configuration.py deleted file mode 100644 index d8b8512d7a72..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_configuration.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 - -from typing import Any - -from corehttp.runtime import policies - -from ._version import VERSION - - -class SingleDiscriminatorClientConfiguration: - """Configuration for SingleDiscriminatorClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-singlediscriminator-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/__init__.py deleted file mode 100644 index f39dfb6f44a7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _SingleDiscriminatorClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_operations.py deleted file mode 100644 index 4a40025c84a7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_operations.py +++ /dev/null @@ -1,611 +0,0 @@ -# coding=utf-8 -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from corehttp.rest import HttpRequest, HttpResponse -from corehttp.runtime import PipelineClient -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.utils import case_insensitive_dict - -from .. import models as _models, types -from .._configuration import SingleDiscriminatorClientConfiguration -from .._utils.model_base import SdkJSONEncoder, _deserialize -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_single_discriminator_get_model_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/model" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_put_model_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/type/model/inheritance/single-discriminator/model" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_get_recursive_model_request( # pylint: disable=name-too-long - **kwargs: Any, -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/recursivemodel" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_put_recursive_model_request( # pylint: disable=name-too-long - **kwargs: Any, -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/type/model/inheritance/single-discriminator/recursivemodel" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_get_missing_discriminator_request( # pylint: disable=name-too-long - **kwargs: Any, -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/missingdiscriminator" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_get_wrong_discriminator_request( # pylint: disable=name-too-long - **kwargs: Any, -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/wrongdiscriminator" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_single_discriminator_get_legacy_model_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/inheritance/single-discriminator/legacy-model" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -class _SingleDiscriminatorClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], SingleDiscriminatorClientConfiguration] -): - - def get_model(self, **kwargs: Any) -> _models.Bird: - """get_model. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put_model(self, input: _models.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def put_model(self, input: types.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.types.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def put_model(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def put_model( # pylint: disable=inconsistent-return-statements - self, input: Union[_models.Bird, types.Bird, IO[bytes]], **kwargs: Any - ) -> None: - """put_model. - - :param input: Is either a Bird type or a IO[bytes] type. Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird or - ~typetest.model.singlediscriminator.typeddict.types.Bird or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_single_discriminator_put_model_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - def get_recursive_model(self, **kwargs: Any) -> _models.Bird: - """get_recursive_model. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_recursive_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put_recursive_model( - self, input: _models.Bird, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def put_recursive_model(self, input: types.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_recursive_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.types.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def put_recursive_model(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_recursive_model. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def put_recursive_model( # pylint: disable=inconsistent-return-statements - self, input: Union[_models.Bird, types.Bird, IO[bytes]], **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Is either a Bird type or a IO[bytes] type. Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird or - ~typetest.model.singlediscriminator.typeddict.types.Bird or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_single_discriminator_put_recursive_model_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - def get_missing_discriminator(self, **kwargs: Any) -> _models.Bird: - """get_missing_discriminator. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_missing_discriminator_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def get_wrong_discriminator(self, **kwargs: Any) -> _models.Bird: - """get_wrong_discriminator. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_wrong_discriminator_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def get_legacy_model(self, **kwargs: Any) -> _models.Dinosaur: - """get_legacy_model. - - :return: Dinosaur. The Dinosaur is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Dinosaur - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Dinosaur] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_legacy_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Dinosaur, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_operations/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/model_base.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/model_base.py deleted file mode 100644 index 99877baf4b2f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/model_base.py +++ /dev/null @@ -1,1731 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# pylint: disable=protected-access, broad-except - -import copy -import calendar -import decimal -import functools -import sys -import logging -import base64 -import re -import typing -import enum -import email.utils -from datetime import datetime, date, time, timedelta, timezone -from json import JSONEncoder -import xml.etree.ElementTree as ET -from collections.abc import MutableMapping -import isodate -from corehttp.exceptions import DeserializationError -from corehttp.utils import CaseInsensitiveEnumMeta -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.serialization import _Null - -from corehttp.rest import HttpResponse - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_LOGGER = logging.getLogger(__name__) - -__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] - -TZ_UTC = timezone.utc -_T = typing.TypeVar("_T") -_NONE_TYPE = type(None) - - -def _timedelta_as_isostr(td: timedelta) -> str: - """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' - - Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython - - :param timedelta td: The timedelta to convert - :rtype: str - :return: ISO8601 version of this timedelta - """ - - # Split seconds to larger units - seconds = td.total_seconds() - minutes, seconds = divmod(seconds, 60) - hours, minutes = divmod(minutes, 60) - days, hours = divmod(hours, 24) - - days, hours, minutes = list(map(int, (days, hours, minutes))) - seconds = round(seconds, 6) - - # Build date - date_str = "" - if days: - date_str = "%sD" % days - - if hours or minutes or seconds: - # Build time - time_str = "T" - - # Hours - bigger_exists = date_str or hours - if bigger_exists: - time_str += "{:02}H".format(hours) - - # Minutes - bigger_exists = bigger_exists or minutes - if bigger_exists: - time_str += "{:02}M".format(minutes) - - # Seconds - try: - if seconds.is_integer(): - seconds_string = "{:02}".format(int(seconds)) - else: - # 9 chars long w/ leading 0, 6 digits after decimal - seconds_string = "%09.6f" % seconds - # Remove trailing zeros - seconds_string = seconds_string.rstrip("0") - except AttributeError: # int.is_integer() raises - seconds_string = "{:02}".format(seconds) - - time_str += "{}S".format(seconds_string) - else: - time_str = "" - - return "P" + date_str + time_str - - -def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: - encoded = base64.b64encode(o).decode() - if format == "base64url": - return encoded.strip("=").replace("+", "-").replace("/", "_") - return encoded - - -def _serialize_datetime(o, format: typing.Optional[str] = None): - if hasattr(o, "year") and hasattr(o, "hour"): - if format == "rfc7231": - return email.utils.format_datetime(o, usegmt=True) - if format == "unix-timestamp": - return int(calendar.timegm(o.utctimetuple())) - - # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) - if not o.tzinfo: - iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() - else: - iso_formatted = o.astimezone(TZ_UTC).isoformat() - # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) - return iso_formatted.replace("+00:00", "Z") - # Next try datetime.date or datetime.time - return o.isoformat() - - -def _is_readonly(p): - try: - return p._visibility == ["read"] - except AttributeError: - return False - - -class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" - - def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): - super().__init__(*args, **kwargs) - self.exclude_readonly = exclude_readonly - self.format = format - - def default(self, o): # pylint: disable=too-many-return-statements - if _is_model(o): - if self.exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - return {k: v for k, v in o.items() if k not in readonly_props} - return dict(o.items()) - try: - return super(SdkJSONEncoder, self).default(o) - except TypeError: - if isinstance(o, _Null): - return None - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, self.format) - try: - # First try datetime.datetime - return _serialize_datetime(o, self.format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return super(SdkJSONEncoder, self).default(o) - - -_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") -_VALID_RFC7231 = re.compile( - r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" - r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" -) - -_ARRAY_ENCODE_MAPPING = { - "pipeDelimited": "|", - "spaceDelimited": " ", - "commaDelimited": ",", - "newlineDelimited": "\n", -} - - -def _deserialize_array_encoded(delimit: str, attr): - if isinstance(attr, str): - if attr == "": - return [] - return attr.split(delimit) - return attr - - -def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - attr = attr.upper() - match = _VALID_DATE.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - return date_obj # type: ignore[no-any-return] - - -def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: - """Deserialize RFC7231 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - match = _VALID_RFC7231.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - return email.utils.parsedate_to_datetime(attr) - - -def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: - """Deserialize unix timestamp into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: ~datetime.datetime - :returns: The datetime object from that input - """ - if isinstance(attr, datetime): - # i'm already deserialized - return attr - return datetime.fromtimestamp(attr, TZ_UTC) - - -def _deserialize_date(attr: typing.Union[str, date]) -> date: - """Deserialize ISO-8601 formatted string into Date object. - :param str attr: response string to be deserialized. - :rtype: date - :returns: The date object from that input - """ - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - if isinstance(attr, date): - return attr - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore - - -def _deserialize_time(attr: typing.Union[str, time]) -> time: - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :returns: The time object from that input - """ - if isinstance(attr, time): - return attr - return isodate.parse_time(attr) # type: ignore[no-any-return] - - -def _deserialize_bytes(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - return bytes(base64.b64decode(attr)) - - -def _deserialize_bytes_base64(attr): - if isinstance(attr, (bytes, bytearray)): - return attr - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return bytes(base64.b64decode(encoded)) - - -def _deserialize_duration(attr): - if isinstance(attr, timedelta): - return attr - return isodate.parse_duration(attr) - - -def _deserialize_decimal(attr): - if isinstance(attr, decimal.Decimal): - return attr - return decimal.Decimal(str(attr)) - - -def _deserialize_int_as_str(attr): - if isinstance(attr, int): - return attr - return int(attr) - - -_DESERIALIZE_MAPPING = { - datetime: _deserialize_datetime, - date: _deserialize_date, - time: _deserialize_time, - bytes: _deserialize_bytes, - bytearray: _deserialize_bytes, - timedelta: _deserialize_duration, - typing.Any: lambda x: x, - decimal.Decimal: _deserialize_decimal, -} - -_DESERIALIZE_MAPPING_WITHFORMAT = { - "rfc3339": _deserialize_datetime, - "rfc7231": _deserialize_datetime_rfc7231, - "unix-timestamp": _deserialize_datetime_unix_timestamp, - "base64": _deserialize_bytes, - "base64url": _deserialize_bytes_base64, -} - - -def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): - if annotation is int and rf and rf._format == "str": - return _deserialize_int_as_str - if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: - return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) - if rf and rf._format: - return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) - return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore - - -def _get_type_alias_type(module_name: str, alias_name: str): - types = { - k: v - for k, v in sys.modules[module_name].__dict__.items() - if isinstance(v, typing._GenericAlias) # type: ignore - } - if alias_name not in types: - return alias_name - return types[alias_name] - - -def _get_model(module_name: str, model_name: str): - models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} - module_end = module_name.rsplit(".", 1)[0] - models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) - if isinstance(model_name, str): - model_name = model_name.split(".")[-1] - if model_name not in models: - return model_name - return models[model_name] - - -_UNSET = object() - - -class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: dict[str, typing.Any]) -> None: - self._data = data - - def __contains__(self, key: typing.Any) -> bool: - return key in self._data - - def __getitem__(self, key: str) -> typing.Any: - # If this key has been deserialized (for mutable types), we need to handle serialization - if hasattr(self, "_attr_to_rest_field"): - cache_attr = f"_deserialized_{key}" - if hasattr(self, cache_attr): - rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) - if rf: - value = self._data.get(key) - if isinstance(value, (dict, list, set)): - # For mutable types, serialize and return - # But also update _data with serialized form and clear flag - # so mutations via this returned value affect _data - serialized = _serialize(value, rf._format) - # If serialized form is same type (no transformation needed), - # return _data directly so mutations work - if isinstance(serialized, type(value)) and serialized == value: - return self._data.get(key) - # Otherwise return serialized copy and clear flag - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - # Store serialized form back - self._data[key] = serialized - return serialized - return self._data.__getitem__(key) - - def __setitem__(self, key: str, value: typing.Any) -> None: - # Clear any cached deserialized value when setting through dictionary access - cache_attr = f"_deserialized_{key}" - try: - object.__delattr__(self, cache_attr) - except AttributeError: - pass - self._data.__setitem__(key, value) - - def __delitem__(self, key: str) -> None: - self._data.__delitem__(key) - - def __iter__(self) -> typing.Iterator[typing.Any]: - return self._data.__iter__() - - def __len__(self) -> int: - return self._data.__len__() - - def __ne__(self, other: typing.Any) -> bool: - return not self.__eq__(other) - - def keys(self) -> typing.KeysView[str]: - """ - :returns: a set-like object providing a view on D's keys - :rtype: ~typing.KeysView - """ - return self._data.keys() - - def values(self) -> typing.ValuesView[typing.Any]: - """ - :returns: an object providing a view on D's values - :rtype: ~typing.ValuesView - """ - return self._data.values() - - def items(self) -> typing.ItemsView[str, typing.Any]: - """ - :returns: set-like object providing a view on D's items - :rtype: ~typing.ItemsView - """ - return self._data.items() - - def get(self, key: str, default: typing.Any = None) -> typing.Any: - """ - Get the value for key if key is in the dictionary, else default. - :param str key: The key to look up. - :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. - :rtype: any - """ - try: - return self[key] - except KeyError: - return default - - @typing.overload - def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ - - @typing.overload - def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs - - @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Removes specified key and return the corresponding value. - :param str key: The key to pop. - :param any default: The value to return if key is not in the dictionary - :returns: The value corresponding to the key. - :rtype: any - :raises KeyError: If key is not found and default is not given. - """ - if default is _UNSET: - return self._data.pop(key) - return self._data.pop(key, default) - - def popitem(self) -> tuple[str, typing.Any]: - """ - Removes and returns some (key, value) pair - :returns: The (key, value) pair. - :rtype: tuple - :raises KeyError: if D is empty. - """ - return self._data.popitem() - - def clear(self) -> None: - """ - Remove all items from D. - """ - self._data.clear() - - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ - """ - Updates D from mapping/iterable E and F. - :param any args: Either a mapping object or an iterable of key-value pairs. - """ - self._data.update(*args, **kwargs) - - @typing.overload - def setdefault(self, key: str, default: None = None) -> None: ... - - @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs - - def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: - """ - Same as calling D.get(k, d), and setting D[k]=d if k not found - :param str key: The key to look up. - :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. - :rtype: any - """ - if default is _UNSET: - return self._data.setdefault(key) - return self._data.setdefault(key, default) - - def __eq__(self, other: typing.Any) -> bool: - if isinstance(other, _MyMutableMapping): - return self._data == other._data - try: - other_model = self.__class__(other) - except Exception: - return False - return self._data == other_model._data - - def __repr__(self) -> str: - return str(self._data) - - -def _is_model(obj: typing.Any) -> bool: - return getattr(obj, "_is_model", False) - - -def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements - if isinstance(o, list): - if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): - return _ARRAY_ENCODE_MAPPING[format].join(o) - return [_serialize(x, format) for x in o] - if isinstance(o, dict): - return {k: _serialize(v, format) for k, v in o.items()} - if isinstance(o, set): - return {_serialize(x, format) for x in o} - if isinstance(o, tuple): - return tuple(_serialize(x, format) for x in o) - if isinstance(o, (bytes, bytearray)): - return _serialize_bytes(o, format) - if isinstance(o, decimal.Decimal): - return float(o) - if isinstance(o, enum.Enum): - return o.value - if isinstance(o, int): - if format == "str": - return str(o) - return o - try: - # First try datetime.datetime - return _serialize_datetime(o, format) - except AttributeError: - pass - # Last, try datetime.timedelta - try: - return _timedelta_as_isostr(o) - except AttributeError: - # This will be raised when it hits value.total_seconds in the method above - pass - return o - - -def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: - try: - return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) - except StopIteration: - return None - - -def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: - if not rf: - return _serialize(value, None) - if rf._is_multipart_file_input: - return value - if rf._is_model: - return _deserialize(rf._type, value) - if isinstance(value, ET.Element): - value = _deserialize(rf._type, value) - return _serialize(value, rf._format) - - -# ============================================================================ -# Fast-path scalar deserializer functions for rest_field(deserializer=...) -# These are referenced from rest_field declarations to bypass the generic -# _deserialize -> _deserialize_with_callable chain. -# Only simple/primitive types — no models or container types. -# ============================================================================ - - -def _xml_deser_str(value): - if isinstance(value, ET.Element): - return value.text or "" - return str(value) if value is not None else None - - -def _xml_deser_int(value): - if isinstance(value, ET.Element): - return int(value.text) if value.text else None - return int(value) if value is not None else None - - -def _xml_deser_float(value): - if isinstance(value, ET.Element): - return float(value.text) if value.text else None - return float(value) if value is not None else None - - -def _xml_deser_bool(value): - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - if text in (True, False): - return text - return text.lower() == "true" - - -# pylint: disable=docstring-missing-param -def _xml_deser_bytes(value): - """Deserialize bytes from XML (base64).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes(text) - - -def _xml_deser_bytes_base64url(value): - """Deserialize bytes from XML (base64url).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_bytes_base64(text) - - -def _xml_deser_datetime(value): - """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime(text) - - -def _xml_deser_datetime_rfc7231(value): - """Deserialize a datetime from XML (RFC7231 format).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_rfc7231(text) - - -def _xml_deser_datetime_unix_timestamp(value): - """Deserialize a datetime from XML (Unix timestamp).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_datetime_unix_timestamp(float(text)) - - -def _xml_deser_date(value): - """Deserialize a date from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_date(text) - - -def _xml_deser_time(value): - """Deserialize a time from XML (ISO 8601).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_time(text) - - -def _xml_deser_duration(value): - """Deserialize a timedelta from XML (ISO 8601 duration).""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_duration(text) - - -def _xml_deser_decimal(value): - """Deserialize a Decimal from XML.""" - if isinstance(value, ET.Element): - text = value.text - else: - text = value - if text is None: - return None - return _deserialize_decimal(text) - - -def _xml_deser_enum_or_str(enum_cls, value): - """Deserialize a Union[EnumType, str] from XML.""" - text = value.text if isinstance(value, ET.Element) else value - if text is None: - return None - try: - return enum_cls(text) - except ValueError: - return text - - -def _extract_xml_model_type(rf_type): - """Extract the concrete Model class from a resolved rf._type partial chain. - - Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` - wrappers. Only handles Model and Optional[Model] — other composite - types (List, Dict, Union, etc.) return None and fall through to the - generic ``_deserialize`` path at runtime. - """ - if rf_type is None: - return None - if isinstance(rf_type, type) and _is_model(rf_type): - return rf_type - if not isinstance(rf_type, functools.partial): - return None - func = rf_type.func - args = rf_type.args - if func is _deserialize_with_optional and args: - return _extract_xml_model_type(args[0]) - if func is _deserialize_model and args: - cls = args[0] - return cls if isinstance(cls, type) and _is_model(cls) else None - return None - - -def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable - cls, attr_to_rest_field: dict -) -> list: - """Build a precomputed XML field plan for fast _init_from_xml iteration. - - Called once per model class in __new__. Returns a list of tuples: - (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) - - kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text - - For Model and Optional[Model] fields that lack a scalar - ``_deserializer``, this function precomputes the Model class as the - deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` - directly instead of going through the expensive - ``_get_deserialize_callable_from_annotation`` chain at runtime. - """ - model_meta = getattr(cls, "_xml", {}) - model_ns = model_meta.get("ns") or model_meta.get("namespace") - plan = [] - - for rf in attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - deser = rf._deserializer - - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - is_optional = rf._is_optional - - # For Model / Optional[Model] fields without a scalar deserializer, - # precompute the Model class as the deserializer. - if deser is None and rf._type is not None: - model_cls = _extract_xml_model_type(rf._type) - if model_cls is not None: - deser = model_cls - - if prop_meta.get("attribute", False): - plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) - elif prop_meta.get("unwrapped", False): - items_name = prop_meta.get("itemsName") - if items_name: - items_ns = prop_meta.get("itemsNs") - if items_ns is not None: - xml_ns = items_ns - if xml_ns: - items_name = "{" + xml_ns + "}" + items_name - else: - items_name = xml_name - plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) - elif prop_meta.get("text", False): - plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) - else: - plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) - - return plan - - -# pylint: enable=docstring-missing-param -class Model(_MyMutableMapping): - _is_model = True - # label whether current class's _attr_to_rest_field has been calculated - # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: set[str] = set() - - def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: - class_name = self.__class__.__name__ - if len(args) > 1: - raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass: dict[str, typing.Any] = {} - if args: - if isinstance(args[0], ET.Element): - dict_to_pass.update(self._init_from_xml(args[0])) - else: - dict_to_pass.update( - {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} - ) - else: - non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] - if non_attr_kwargs: - # actual type errors only throw the first wrong keyword arg they see, so following that. - raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") - dict_to_pass.update( - { - self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) - for k, v in kwargs.items() - if v is not None - } - ) - # Apply client default values for fields the caller didn't set so that - # defaults are part of `_data` and therefore included during serialization. - for rf in self._attr_to_rest_field.values(): - if rf._default is _UNSET: - continue - if rf._rest_name in dict_to_pass: - continue - dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) - super().__init__(dict_to_pass) - - def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements - self, element: ET.Element - ) -> dict[str, typing.Any]: - """Deserialize an XML element into a dict mapping rest field names to values. - - :param ET.Element element: The XML element to deserialize from. - :returns: A dictionary of rest_name to deserialized value pairs. - :rtype: dict - """ - result: dict[str, typing.Any] = {} - existed_attr_keys: list[str] = [] - - field_plan = getattr(self, "_xml_field_plan", None) - if field_plan: - for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: - if kind == 0: # wrapped element (most common) - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(item) - else: - result[rest_name] = _deserialize(rf_type, item) - elif kind == 1: # attribute - attr_val = element.get(xml_name) - if attr_val is not None: - existed_attr_keys.append(xml_name) - if deser: - result[rest_name] = deser(attr_val) - else: - result[rest_name] = attr_val - elif kind == 2: # unwrapped array - items = element.findall(items_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(items_name) - if deser: - result[rest_name] = deser(items) - else: - result[rest_name] = _deserialize(rf_type, items) - elif not is_optional: - existed_attr_keys.append(items_name) - result[rest_name] = [] - elif kind == 3: # text - if element.text is not None: - if deser: - result[rest_name] = deser(element.text) - else: - result[rest_name] = element.text - else: - model_meta = getattr(self, "_xml", {}) - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in element: - if e.tag not in existed_attr_keys: - result[e.tag] = _convert_element(e) - - return result - - def copy(self) -> "Model": - return Model(self.__dict__) - - 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' - mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property - k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") - } - annotations = { - k: v - for mro_class in mros - 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__ - if not rf._type: - rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) - if not rf._rest_name_input: - rf._rest_name_input = attr - cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) - # Build XML field plan for fast _init_from_xml (only for XML models) - if getattr(cls, "_xml", None): - cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) - cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - - return super().__new__(cls) - - def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: - for base in cls.__bases__: - if hasattr(base, "__mapping__"): - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore - - @classmethod - def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: - for v in cls.__dict__.values(): - if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: - return v - return None - - @classmethod - def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): - return cls(data) - discriminator = cls._get_discriminator(exist_discriminators) - if discriminator is None: - return cls(data) - exist_discriminators.append(discriminator._rest_name) - if isinstance(data, ET.Element): - model_meta = getattr(cls, "_xml", {}) - prop_meta = getattr(discriminator, "_xml", {}) - xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - if data.get(xml_name) is not None: - discriminator_value = data.get(xml_name) - else: - 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 - return mapped_cls._deserialize(data, exist_discriminators) - - def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: - """Return a dict that can be turned into json using json.dump. - - :keyword bool exclude_readonly: Whether to remove the readonly properties. - :returns: A dict JSON compatible object - :rtype: dict - """ - - result = {} - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] - for k, v in self.items(): - if exclude_readonly and k in readonly_props: # pyright: ignore - continue - is_multipart_file_input = False - try: - is_multipart_file_input = next( - rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k - )._is_multipart_file_input - except StopIteration: - pass - result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) - return result - - @staticmethod - def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: - if v is None or isinstance(v, _Null): - return None - if isinstance(v, (list, tuple, set)): - return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) - if isinstance(v, dict): - return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} - return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v - - -def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - - -def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - -def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - - -def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj: dict[typing.Any, typing.Any], -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = {child.tag: child for child in obj} - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - - -def _deserialize_multiple_sequence( - entry_deserializers: list[typing.Optional[typing.Callable]], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) - - -def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: - return ( - isinstance(deserializer, functools.partial) - and isinstance(deserializer.args[0], functools.partial) - and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable - ) - - -def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - module: typing.Optional[str], - obj, -): - if obj is None: - return obj - if isinstance(obj, ET.Element): - obj = list(obj) - - # encoded string may be deserialized to sequence - if isinstance(obj, str) and isinstance(deserializer, functools.partial): - # for list[str] - if _is_array_encoded_deserializer(deserializer): - return deserializer(obj) - - # for list[Union[...]] - if isinstance(deserializer.args[0], list): - for sub_deserializer in deserializer.args[0]: - if _is_array_encoded_deserializer(sub_deserializer): - return sub_deserializer(obj) - - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - -def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: - return sorted( - types, - key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), - ) - - -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches - annotation: typing.Any, - module: typing.Optional[str], - rf: typing.Optional["_RestField"] = None, -) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - if not annotation: - return None - - # is it a type alias? - if isinstance(annotation, str): - if module is not None: - annotation = _get_type_alias_type(module, annotation) - - # is it a forward ref / in quotes? - if isinstance(annotation, (str, typing.ForwardRef)): - try: - model_name = annotation.__forward_arg__ # type: ignore - except AttributeError: - model_name = annotation - if module is not None: - annotation = _get_model(module, model_name) # type: ignore - - try: - if module and _is_model(annotation): - if rf: - rf._is_model = True - - return functools.partial(_deserialize_model, annotation) # pyright: ignore - except Exception: - pass - - # is it a literal? - try: - if annotation.__origin__ is typing.Literal: # pyright: ignore - return None - except AttributeError: - pass - - # is it optional? - try: - if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore - if rf: - rf._is_optional = True - if len(annotation.__args__) <= 2: # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) - # the type is Optional[Union[...]], we need to remove the None type from the Union - annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore - return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) - except AttributeError: - pass - - # is it union? - if getattr(annotation, "__origin__", None) is typing.Union: - # initial ordering is we make `string` the last deserialization option, because it is often them most generic - deserializers = [ - _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in _sorted_annotations(annotation.__args__) # pyright: ignore - ] - - return functools.partial(_deserialize_with_union, deserializers) - - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() == "dict": - value_deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[1], module, rf # pyright: ignore - ) - - return functools.partial( - _deserialize_dict, - value_deserializer, - module, - ) - except (AttributeError, IndexError): - pass - try: - annotation_name = ( - annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore - ) - if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: - if len(annotation.__args__) > 1: # pyright: ignore - entry_deserializers = [ - _get_deserialize_callable_from_annotation(dt, module, rf) - for dt in annotation.__args__ # pyright: ignore - ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) - deserializer = _get_deserialize_callable_from_annotation( - annotation.__args__[0], module, rf # pyright: ignore - ) - - return functools.partial(_deserialize_sequence, deserializer, module) - except (TypeError, IndexError, AttributeError, SyntaxError): - pass - - def _deserialize_default( - deserializer, - obj, - ): - if obj is None: - return obj - try: - return _deserialize_with_callable(deserializer, obj) - except Exception: - pass - return obj - - if get_deserializer(annotation, rf): - return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) - - return functools.partial(_deserialize_default, annotation) - - -def _deserialize_with_callable( - deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], - value: typing.Any, -): # pylint: disable=too-many-return-statements - try: - if value is None or isinstance(value, _Null): - return None - if isinstance(value, ET.Element): - if deserializer is str: - return value.text or "" - if deserializer is int: - return int(value.text) if value.text else None - if deserializer is float: - return float(value.text) if value.text else None - if deserializer is bool: - return value.text == "true" if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): - return deserializer(value.text) if value.text else None - if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): - return deserializer(value.text) if value.text else None - if deserializer is None: - return value - if deserializer in [int, float, bool]: - return deserializer(value) - if isinstance(deserializer, CaseInsensitiveEnumMeta): - try: - return deserializer(value.text if isinstance(value, ET.Element) else value) - except ValueError: - # for unknown value, return raw value - return value.text if isinstance(value, ET.Element) else value - if isinstance(deserializer, type) and issubclass(deserializer, Model): - return deserializer._deserialize(value, []) - return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) - except Exception as e: - raise DeserializationError() from e - - -def _deserialize( - deserializer: typing.Any, - value: typing.Any, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - if isinstance(value, PipelineResponse): - value = value.http_response.json() - if rf is None and format: - rf = _RestField(format=format) - if not isinstance(deserializer, functools.partial): - deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) - return _deserialize_with_callable(deserializer, value) - - -def _failsafe_deserialize( - deserializer: typing.Any, - response: HttpResponse, - module: typing.Optional[str] = None, - rf: typing.Optional["_RestField"] = None, - format: typing.Optional[str] = None, -) -> typing.Any: - try: - return _deserialize(deserializer, response.json(), module, rf, format) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -def _failsafe_deserialize_xml( - deserializer: typing.Any, - response: HttpResponse, -) -> typing.Any: - try: - return _deserialize_xml(deserializer, response.text()) - except Exception: # pylint: disable=broad-except - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - -# pylint: disable=too-many-instance-attributes -class _RestField: - def __init__( - self, - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - is_discriminator: bool = False, - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, - ): - self._type = type - self._rest_name_input = name - self._module: typing.Optional[str] = None - self._is_discriminator = is_discriminator - self._visibility = visibility - self._is_model = False - self._is_optional = False - self._default = default - self._format = format - self._is_multipart_file_input = is_multipart_file_input - self._xml = xml if xml is not None else {} - self._deserializer = deserializer - - @property - def _class_type(self) -> typing.Any: - result = getattr(self._type, "args", [None])[0] - # type may be wrapped by nested functools.partial so we need to check for that - if isinstance(result, functools.partial): - return getattr(result, "args", [None])[0] - return result - - @property - def _rest_name(self) -> str: - if self._rest_name_input is None: - raise ValueError("Rest name was never set") - return self._rest_name_input - - def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin - # by this point, type and rest_name will have a value bc we default - # them in __new__ of the Model class - # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name, _UNSET) - if item is _UNSET: - # Field not set by user; return the client default if one exists, otherwise None - return self._default if self._default is not _UNSET else None - if item is None: - return item - if self._is_model: - return item - - # For mutable types, we want mutations to directly affect _data - # Check if we've already deserialized this value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - # Return the value from _data directly (it's been deserialized in place) - return obj._data.get(self._rest_name) - - # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) - if self._deserializer: - deserialized = self._deserializer(item) - else: - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) - - # For mutable types, store the deserialized value back in _data - # so mutations directly affect _data - if isinstance(deserialized, (dict, list, set)): - obj._data[self._rest_name] = deserialized - object.__setattr__(obj, cache_attr, True) # Mark as deserialized - return deserialized - - return deserialized - - def __set__(self, obj: Model, value) -> None: - # Clear the cached deserialized object when setting a new value - cache_attr = f"_deserialized_{self._rest_name}" - if hasattr(obj, cache_attr): - object.__delattr__(obj, cache_attr) - - if value is None: - # we want to wipe out entries if users set attr to None - try: - obj.__delitem__(self._rest_name) - except KeyError: - pass - return - if self._is_model: - if not _is_model(value): - value = _deserialize(self._type, value) - obj.__setitem__(self._rest_name, value) - return - obj.__setitem__(self._rest_name, _serialize(value, self._format)) - - def _get_deserialize_callable_from_annotation( - self, annotation: typing.Any - ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: - return _get_deserialize_callable_from_annotation(annotation, self._module, self) - - -def rest_field( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - default: typing.Any = _UNSET, - format: typing.Optional[str] = None, - is_multipart_file_input: bool = False, - xml: typing.Optional[dict[str, typing.Any]] = None, - deserializer: typing.Optional[typing.Callable] = None, -) -> typing.Any: - return _RestField( - name=name, - type=type, - visibility=visibility, - default=default, - format=format, - is_multipart_file_input=is_multipart_file_input, - xml=xml, - deserializer=deserializer, - ) - - -def rest_discriminator( - *, - name: typing.Optional[str] = None, - type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[list[str]] = None, - xml: typing.Optional[dict[str, typing.Any]] = None, -) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) - - -def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: - """Serialize a model to XML. - - :param Model model: The model to serialize. - :param bool exclude_readonly: Whether to exclude readonly properties. - :returns: The XML representation of the model. - :rtype: str - """ - return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore - - -def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: - """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. - - :param dict meta: The metadata dictionary to extract namespace from. - :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. - :rtype: str or None - """ - ns = meta.get("ns") - if ns is None: - ns = meta.get("namespace") - return ns - - -def _resolve_xml_ns( - prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None -) -> typing.Optional[str]: - """Resolve XML namespace for a property, falling back to model namespace when appropriate. - - Checks the property metadata first; if no namespace is found and the model does not declare - an explicit prefix, falls back to the model-level namespace. - - :param dict prop_meta: The property metadata dictionary. - :param dict model_meta: The model metadata dictionary, used as fallback. - :returns: The resolved namespace string, or None. - :rtype: str or None - """ - ns = _get_xml_ns(prop_meta) - if ns is None and model_meta is not None and not model_meta.get("prefix"): - ns = _get_xml_ns(model_meta) - return ns - - -def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: - """Set an XML attribute on an element, handling namespace prefix registration. - - :param ET.Element element: The element to set the attribute on. - :param str name: The default attribute name (wire name). - :param any value: The attribute value. - :param dict prop_meta: The property metadata dictionary. - """ - xml_name = prop_meta.get("name", name) - _attr_ns = _get_xml_ns(prop_meta) - if _attr_ns: - _attr_prefix = prop_meta.get("prefix") - if _attr_prefix: - _safe_register_namespace(_attr_prefix, _attr_ns) - xml_name = "{" + _attr_ns + "}" + xml_name - element.set(xml_name, _get_primitive_type_value(value)) - - -def _get_element( - o: typing.Any, - exclude_readonly: bool = False, - parent_meta: typing.Optional[dict[str, typing.Any]] = None, - wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, list[ET.Element]]: - if _is_model(o): - model_meta = getattr(o, "_xml", {}) - - # if prop is a model, then use the prop element directly, else generate a wrapper of model - if wrapped_element is None: - # When serializing as an array item (parent_meta is set), check if the parent has an - # explicit itemsName. This ensures correct element names for unwrapped arrays (where - # the element tag is the property/items name, not the model type name). - _items_name = parent_meta.get("itemsName") if parent_meta is not None else None - element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) - _model_ns = _get_xml_ns(model_meta) - wrapped_element = _create_xml_element( - element_name, - model_meta.get("prefix"), - _model_ns, - ) - - readonly_props = [] - if exclude_readonly: - readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] - - for k, v in o.items(): - # do not serialize readonly properties - if exclude_readonly and k in readonly_props: - continue - - prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) - if prop_rest_field: - prop_meta = getattr(prop_rest_field, "_xml").copy() - # use the wire name as xml name if no specific name is set - if prop_meta.get("name") is None: - prop_meta["name"] = k - else: - # additional properties will not have rest field, use the wire name as xml name - prop_meta = {"name": k} - - # Propagate model namespace to properties only for old-style "ns"-keyed models. - # DPG-generated models use the "namespace" key and explicitly declare namespace on - # each property that needs it, so propagation is intentionally skipped for them. - if prop_meta.get("ns") is None and model_meta.get("ns"): - prop_meta["ns"] = model_meta.get("ns") - prop_meta["prefix"] = model_meta.get("prefix") - - if prop_meta.get("unwrapped", False): - # unwrapped could only set on array - wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) - elif prop_meta.get("text", False): - # text could only set on primitive type - wrapped_element.text = _get_primitive_type_value(v) - elif prop_meta.get("attribute", False): - _set_xml_attribute(wrapped_element, k, v, prop_meta) - else: - # other wrapped prop element - wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) - return wrapped_element - if isinstance(o, list): - return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore - if isinstance(o, dict): - result = [] - _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None - for k, v in o.items(): - result.append( - _get_wrapped_element( - v, - exclude_readonly, - { - "name": k, - "ns": _dict_ns, - "prefix": parent_meta.get("prefix") if parent_meta else None, - }, - ) - ) - return result - - # primitive case need to create element based on parent_meta - if parent_meta: - _items_ns = parent_meta.get("itemsNs") - if _items_ns is None: - _items_ns = _get_xml_ns(parent_meta) - return _get_wrapped_element( - o, - exclude_readonly, - { - "name": parent_meta.get("itemsName", parent_meta.get("name")), - "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": _items_ns, - }, - ) - - raise ValueError("Could not serialize value into xml: " + o) - - -def _get_wrapped_element( - v: typing.Any, - exclude_readonly: bool, - meta: typing.Optional[dict[str, typing.Any]], -) -> ET.Element: - _meta_ns = _get_xml_ns(meta) if meta else None - wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns - ) - if isinstance(v, (dict, list)): - wrapped_element.extend(_get_element(v, exclude_readonly, meta)) - elif _is_model(v): - _get_element(v, exclude_readonly, meta, wrapped_element) - else: - wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element # type: ignore[no-any-return] - - -def _get_primitive_type_value(v) -> str: - if v is True: - return "true" - if v is False: - return "false" - if isinstance(v, _Null): - return "" - return str(v) - - -def _safe_register_namespace(prefix: str, ns: str) -> None: - """Register an XML namespace prefix, handling reserved prefix patterns. - - Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for - auto-generated prefixes, causing register_namespace to raise ValueError. - Falls back to directly registering in the internal namespace map. - - :param str prefix: The namespace prefix to register. - :param str ns: The namespace URI. - """ - try: - ET.register_namespace(prefix, ns) - except ValueError: - _ns_map = getattr(ET, "_namespace_map", None) - if _ns_map is not None: - _ns_map[ns] = prefix - - -def _create_xml_element( - tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None -) -> ET.Element: - if prefix and ns: - _safe_register_namespace(prefix, ns) - if ns: - return ET.Element("{" + ns + "}" + tag) - return ET.Element(tag) - - -def _deserialize_xml( - deserializer: typing.Any, - value: str, -) -> typing.Any: - element = ET.fromstring(value) # nosec - if _is_model(deserializer): - return deserializer._deserialize(element, []) - return _deserialize(deserializer, element) - - -def _convert_element(e: ET.Element): - # dict case - if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: dict[str, typing.Any] = {} - for child in e: - if dict_result.get(child.tag) is not None: - if isinstance(dict_result[child.tag], list): - dict_result[child.tag].append(_convert_element(child)) - else: - dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] - else: - dict_result[child.tag] = _convert_element(child) - dict_result.update(e.attrib) - return dict_result - # array case - if len(e) > 0: - array_result: list[typing.Any] = [] - for child in e: - array_result.append(_convert_element(child)) - return array_result - # primitive case - return e.text diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/serialization.py deleted file mode 100644 index 8e648e299998..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/serialization.py +++ /dev/null @@ -1,2060 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore - -from corehttp.exceptions import DeserializationError, SerializationError -from corehttp.serialization import NULL as CoreNull - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # Fast path for header deserialization: response_data is a plain str or None - # and target_obj is a simple scalar type. This avoids the expensive - # _unpack_content → _deserialize → _classify_target → deserialize_data chain. - if response_data is None: - return None - if target_obj == "str" and isinstance(response_data, str): - return response_data - if isinstance(response_data, str): - if target_obj == "int": - return int(response_data) - if target_obj == "bool": - if response_data in ("true", "1", "True"): - return True - if response_data in ("false", "0", "False"): - return False - return bool(response_data) - if target_obj == "rfc-1123": - return Deserializer.deserialize_rfc(response_data) - if target_obj == "bytearray": - return Deserializer.deserialize_bytearray(response_data) - - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/utils.py deleted file mode 100644 index 02aa2f816ea7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_utils/utils.py +++ /dev/null @@ -1,18 +0,0 @@ -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_version.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_version.py deleted file mode 100644 index 9f6458b8cdac..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/_version.py +++ /dev/null @@ -1,3 +0,0 @@ -# coding=utf-8 - -VERSION = "1.0.0b1" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/__init__.py deleted file mode 100644 index 44af1792f8ab..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import SingleDiscriminatorClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SingleDiscriminatorClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_client.py deleted file mode 100644 index 8c5c8bca8845..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_client.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding=utf-8 - -from copy import deepcopy -import sys -from typing import Any, Awaitable - -from corehttp.rest import AsyncHttpResponse, HttpRequest -from corehttp.runtime import AsyncPipelineClient, policies - -from .._utils.serialization import Deserializer, Serializer -from ._configuration import SingleDiscriminatorClientConfiguration -from ._operations import _SingleDiscriminatorClientOperationsMixin - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class SingleDiscriminatorClient( - _SingleDiscriminatorClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword - """Illustrates inheritance with single discriminator. - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = SingleDiscriminatorClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.retry_policy, - self._config.authentication_policy, - self._config.logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(endpoint=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from corehttp.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~corehttp.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~corehttp.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_configuration.py deleted file mode 100644 index ace2c5d58d8b..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_configuration.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 - -from typing import Any - -from corehttp.runtime import policies - -from .._version import VERSION - - -class SingleDiscriminatorClientConfiguration: - """Configuration for SingleDiscriminatorClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-singlediscriminator-typeddict/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/__init__.py deleted file mode 100644 index f39dfb6f44a7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _SingleDiscriminatorClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_operations.py deleted file mode 100644 index dfe40a148e9d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_operations.py +++ /dev/null @@ -1,524 +0,0 @@ -# coding=utf-8 -from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from corehttp.rest import AsyncHttpResponse, HttpRequest -from corehttp.runtime import AsyncPipelineClient -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.utils import case_insensitive_dict - -from ... import models as _models, types -from ..._operations._operations import ( - build_single_discriminator_get_legacy_model_request, - build_single_discriminator_get_missing_discriminator_request, - build_single_discriminator_get_model_request, - build_single_discriminator_get_recursive_model_request, - build_single_discriminator_get_wrong_discriminator_request, - build_single_discriminator_put_model_request, - build_single_discriminator_put_recursive_model_request, -) -from ..._utils.model_base import SdkJSONEncoder, _deserialize -from ..._utils.utils import ClientMixinABC -from .._configuration import SingleDiscriminatorClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _SingleDiscriminatorClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], SingleDiscriminatorClientConfiguration] -): - - async def get_model(self, **kwargs: Any) -> _models.Bird: - """get_model. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put_model(self, input: _models.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def put_model(self, input: types.Bird, *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.types.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def put_model(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """put_model. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def put_model(self, input: Union[_models.Bird, types.Bird, IO[bytes]], **kwargs: Any) -> None: - """put_model. - - :param input: Is either a Bird type or a IO[bytes] type. Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird or - ~typetest.model.singlediscriminator.typeddict.types.Bird or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_single_discriminator_put_model_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def get_recursive_model(self, **kwargs: Any) -> _models.Bird: - """get_recursive_model. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_recursive_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put_recursive_model( - self, input: _models.Bird, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def put_recursive_model( - self, input: types.Bird, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Required. - :type input: ~typetest.model.singlediscriminator.typeddict.types.Bird - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def put_recursive_model( - self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """put_recursive_model. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def put_recursive_model(self, input: Union[_models.Bird, types.Bird, IO[bytes]], **kwargs: Any) -> None: - """put_recursive_model. - - :param input: Is either a Bird type or a IO[bytes] type. Required. - :type input: ~typetest.model.singlediscriminator.typeddict.models.Bird or - ~typetest.model.singlediscriminator.typeddict.types.Bird or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _content = json.dumps(input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_single_discriminator_put_recursive_model_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def get_missing_discriminator(self, **kwargs: Any) -> _models.Bird: - """get_missing_discriminator. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_missing_discriminator_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def get_wrong_discriminator(self, **kwargs: Any) -> _models.Bird: - """get_wrong_discriminator. - - :return: Bird. The Bird is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Bird - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Bird] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_wrong_discriminator_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Bird, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def get_legacy_model(self, **kwargs: Any) -> _models.Dinosaur: - """get_legacy_model. - - :return: Dinosaur. The Dinosaur is compatible with MutableMapping - :rtype: ~typetest.model.singlediscriminator.typeddict.models.Dinosaur - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Dinosaur] = kwargs.pop("cls", None) - - _request = build_single_discriminator_get_legacy_model_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Dinosaur, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_operations/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/aio/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/__init__.py deleted file mode 100644 index 04145d222153..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models import ( # type: ignore - Bird, - Dinosaur, - Eagle, - Goose, - SeaGull, - Sparrow, - TRex, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Bird", - "Dinosaur", - "Eagle", - "Goose", - "SeaGull", - "Sparrow", - "TRex", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_models.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_models.py deleted file mode 100644 index 537f1ea60aa1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_models.py +++ /dev/null @@ -1,253 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# pylint: disable=useless-super-delegation - -from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, overload - -from .._utils.model_base import Model as _Model, rest_discriminator, rest_field - -if TYPE_CHECKING: - from .. import models as _models - - -class Bird(_Model): - """This is base model for polymorphic single level inheritance with a discriminator. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - Eagle, Goose, SeaGull, Sparrow - - :ivar kind: Required. Default value is None. - :vartype kind: str - :ivar wingspan: Required. - :vartype wingspan: int - """ - - __mapping__: dict[str, _Model] = {} - kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """Required. Default value is None.""" - wingspan: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - kind: str, - wingspan: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Dinosaur(_Model): - """Define a base class in the legacy way. Discriminator property is not explicitly defined in the - model. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - TRex - - :ivar kind: Discriminator property for Dinosaur. Required. Default value is None. - :vartype kind: str - :ivar size: Required. - :vartype size: int - """ - - __mapping__: dict[str, _Model] = {} - kind: str = rest_discriminator(name="kind") - """Discriminator property for Dinosaur. Required. Default value is None.""" - size: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Required.""" - - @overload - def __init__( - self, - *, - kind: str, - size: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class Eagle(Bird, discriminator="eagle"): - """The second level model in polymorphic single levels inheritance which contains references to - other polymorphic instances. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "eagle". - :vartype kind: str - :ivar friends: - :vartype friends: list[~typetest.model.singlediscriminator.typeddict.models.Bird] - :ivar hate: - :vartype hate: dict[str, ~typetest.model.singlediscriminator.typeddict.models.Bird] - :ivar partner: - :vartype partner: ~typetest.model.singlediscriminator.typeddict.models.Bird - """ - - kind: Literal["eagle"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"eagle\".""" - friends: Optional[list["_models.Bird"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - hate: Optional[dict[str, "_models.Bird"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - partner: Optional["_models.Bird"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - - @overload - def __init__( - self, - *, - wingspan: int, - friends: Optional[list["_models.Bird"]] = None, - hate: Optional[dict[str, "_models.Bird"]] = None, - partner: Optional["_models.Bird"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "eagle" # type: ignore - - -class Goose(Bird, discriminator="goose"): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "goose". - :vartype kind: str - """ - - kind: Literal["goose"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"goose\".""" - - @overload - def __init__( - self, - *, - wingspan: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "goose" # type: ignore - - -class SeaGull(Bird, discriminator="seagull"): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "seagull". - :vartype kind: str - """ - - kind: Literal["seagull"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"seagull\".""" - - @overload - def __init__( - self, - *, - wingspan: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "seagull" # type: ignore - - -class Sparrow(Bird, discriminator="sparrow"): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "sparrow". - :vartype kind: str - """ - - kind: Literal["sparrow"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"sparrow\".""" - - @overload - def __init__( - self, - *, - wingspan: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "sparrow" # type: ignore - - -class TRex(Dinosaur, discriminator="t-rex"): - """The second level legacy model in polymorphic single level inheritance. - - :ivar size: Required. - :vartype size: int - :ivar kind: Required. Default value is "t-rex". - :vartype kind: str - """ - - kind: Literal["t-rex"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Required. Default value is \"t-rex\".""" - - @overload - def __init__( - self, - *, - size: int, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.kind = "t-rex" # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/models/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/py.typed b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/types.py deleted file mode 100644 index 318c4376bb55..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator-typeddict/typetest/model/singlediscriminator/typeddict/types.py +++ /dev/null @@ -1,93 +0,0 @@ -# coding=utf-8 - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class Eagle(TypedDict, total=False): - """The second level model in polymorphic single levels inheritance which contains references to - other polymorphic instances. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "eagle". - :vartype kind: str - :ivar friends: - :vartype friends: list[~typetest.model.singlediscriminator.typeddict.models.Bird] - :ivar hate: - :vartype hate: dict[str, ~typetest.model.singlediscriminator.typeddict.models.Bird] - :ivar partner: - :vartype partner: ~typetest.model.singlediscriminator.typeddict.models.Bird - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["eagle"]] - """Required. Default value is \"eagle\".""" - friends: list["Bird"] - hate: dict[str, "Bird"] - partner: "Bird" - - -class Goose(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "goose". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["goose"]] - """Required. Default value is \"goose\".""" - - -class SeaGull(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "seagull". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["seagull"]] - """Required. Default value is \"seagull\".""" - - -class Sparrow(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "sparrow". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["sparrow"]] - """Required. Default value is \"sparrow\".""" - - -class TRex(TypedDict, total=False): - """The second level legacy model in polymorphic single level inheritance. - - :ivar size: Required. - :vartype size: int - :ivar kind: Required. Default value is "t-rex". - :vartype kind: str - """ - - size: Required[int] - """Required.""" - kind: Required[Literal["t-rex"]] - """Required. Default value is \"t-rex\".""" - - -Bird = Union[Eagle, Goose, SeaGull, Sparrow] -Dinosaur = Union[TRex] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/types.py deleted file mode 100644 index e4c53efa0f72..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/types.py +++ /dev/null @@ -1,93 +0,0 @@ -# coding=utf-8 - -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class Eagle(TypedDict, total=False): - """The second level model in polymorphic single levels inheritance which contains references to - other polymorphic instances. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "eagle". - :vartype kind: str - :ivar friends: - :vartype friends: list[~typetest.model.singlediscriminator.models.Bird] - :ivar hate: - :vartype hate: dict[str, ~typetest.model.singlediscriminator.models.Bird] - :ivar partner: - :vartype partner: ~typetest.model.singlediscriminator.models.Bird - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["eagle"]] - """Required. Default value is \"eagle\".""" - friends: list["Bird"] - hate: dict[str, "Bird"] - partner: "Bird" - - -class Goose(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "goose". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["goose"]] - """Required. Default value is \"goose\".""" - - -class SeaGull(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "seagull". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["seagull"]] - """Required. Default value is \"seagull\".""" - - -class Sparrow(TypedDict, total=False): - """The second level model in polymorphic single level inheritance. - - :ivar wingspan: Required. - :vartype wingspan: int - :ivar kind: Required. Default value is "sparrow". - :vartype kind: str - """ - - wingspan: Required[int] - """Required.""" - kind: Required[Literal["sparrow"]] - """Required. Default value is \"sparrow\".""" - - -class TRex(TypedDict, total=False): - """The second level legacy model in polymorphic single level inheritance. - - :ivar size: Required. - :vartype size: int - :ivar kind: Required. Default value is "t-rex". - :vartype kind: str - """ - - size: Required[int] - """Required.""" - kind: Required[Literal["t-rex"]] - """Required. Default value is \"t-rex\".""" - - -Bird = Union[Eagle, Goose, SeaGull, Sparrow] -Dinosaur = Union[TRex] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/CHANGELOG.md deleted file mode 100644 index b957b2575b48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# Release History - -## 1.0.0b1 (1970-01-01) - -### Other Changes - - - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/MANIFEST.in b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/MANIFEST.in deleted file mode 100644 index 77f246974077..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include *.md -include LICENSE -include typetest/model/usage/typeddictonly/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include typetest/__init__.py -include typetest/model/__init__.py -include typetest/model/usage/__init__.py diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/pyproject.toml b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/pyproject.toml deleted file mode 100644 index 217365d1639d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/pyproject.toml +++ /dev/null @@ -1,51 +0,0 @@ - -[build-system] -requires = ["setuptools>=77.0.3", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -name = "typetest-model-usage-typeddictonly" -authors = [ - { name = "" }, -] -description = " Typetest Model Usage Typeddictonly Client Library for Python" -license = "MIT" -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", -] -requires-python = ">=3.10" - -dependencies = [ - "isodate>=0.6.1", - "corehttp[requests]>=1.0.0b6", - "typing-extensions>=4.6.0", -] -dynamic = [ -"version", "readme" -] - -[tool.setuptools.dynamic] -version = {attr = "typetest.model.usage.typeddictonly._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} - -[tool.setuptools.packages.find] -exclude = [ - "tests*", - "generated_tests*", - "samples*", - "generated_samples*", - "doc*", - "typetest", - "typetest.model", - "typetest.model.usage", -] - -[tool.setuptools.package-data] -pytyped = ["py.typed"] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/__init__.py deleted file mode 100644 index f16aaa799b1e..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import UsageClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "UsageClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_client.py deleted file mode 100644 index e8dd4f5ff965..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_client.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding=utf-8 - -from copy import deepcopy -import sys -from typing import Any - -from corehttp.rest import HttpRequest, HttpResponse -from corehttp.runtime import PipelineClient, policies - -from ._configuration import UsageClientConfiguration -from ._operations import _UsageClientOperationsMixin -from ._utils.serialization import Deserializer, Serializer - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Illustrates usage of Record in different places(Operation parameters, return type or both). - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = UsageClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.retry_policy, - self._config.authentication_policy, - self._config.logging_policy, - ] - self._client: PipelineClient = PipelineClient(endpoint=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from corehttp.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~corehttp.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~corehttp.rest.HttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_configuration.py deleted file mode 100644 index 3a11f750a268..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_configuration.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 - -from typing import Any - -from corehttp.runtime import policies - -from ._version import VERSION - - -class UsageClientConfiguration: - """Configuration for UsageClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-usage-typeddictonly/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/__init__.py deleted file mode 100644 index 1505a449ad48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _UsageClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_operations.py deleted file mode 100644 index a067445b27db..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_operations.py +++ /dev/null @@ -1,383 +0,0 @@ -# coding=utf-8 -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from corehttp.rest import HttpRequest, HttpResponse -from corehttp.runtime import PipelineClient -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.utils import case_insensitive_dict - -from .. import types -from .._configuration import UsageClientConfiguration -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_usage_input_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/type/model/usage/input" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_usage_output_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/usage/output" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_usage_input_and_output_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/type/model/usage/input-output" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -class _UsageClientOperationsMixin(ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], UsageClientConfiguration]): - - @overload - def input(self, input: types.InputRecord, *, content_type: str = "application/json", **kwargs: Any) -> None: - """input. - - :param input: Required. - :type input: ~typetest.model.usage.typeddictonly.types.InputRecord - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - input = { - "requiredProp": "str" - } - """ - - @overload - def input(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """input. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def input( # pylint: disable=inconsistent-return-statements - self, input: Union[types.InputRecord, IO[bytes]], **kwargs: Any - ) -> None: - """input. - - :param input: Is either a InputRecord type or a IO[bytes] type. Required. - :type input: ~typetest.model.usage.typeddictonly.types.InputRecord or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - input = { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _json = input - - _request = build_usage_input_request( - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - def output(self, **kwargs: Any) -> types.OutputRecord: - """output. - - :return: OutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.OutputRecord - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[types.OutputRecord] = kwargs.pop("cls", None) - - _request = build_usage_output_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def input_and_output( - self, body: types.InputOutputRecord, *, content_type: str = "application/json", **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Required. - :type body: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "requiredProp": "str" - } - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - - @overload - def input_and_output( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - - def input_and_output( - self, body: Union[types.InputOutputRecord, IO[bytes]], **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Is either a InputOutputRecord type or a IO[bytes] type. Required. - :type body: ~typetest.model.usage.typeddictonly.types.InputOutputRecord or IO[bytes] - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "requiredProp": "str" - } - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[types.InputOutputRecord] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = body - - _request = build_usage_input_and_output_request( - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_operations/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/serialization.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/serialization.py deleted file mode 100644 index 8e648e299998..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/serialization.py +++ /dev/null @@ -1,2060 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore - -from corehttp.exceptions import DeserializationError, SerializationError -from corehttp.serialization import NULL as CoreNull - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - 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: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # Fast path for header deserialization: response_data is a plain str or None - # and target_obj is a simple scalar type. This avoids the expensive - # _unpack_content → _deserialize → _classify_target → deserialize_data chain. - if response_data is None: - return None - if target_obj == "str" and isinstance(response_data, str): - return response_data - if isinstance(response_data, str): - if target_obj == "int": - return int(response_data) - if target_obj == "bool": - if response_data in ("true", "1", "True"): - return True - if response_data in ("false", "0", "False"): - return False - return bool(response_data) - if target_obj == "rfc-1123": - return Deserializer.deserialize_rfc(response_data) - if target_obj == "bytearray": - return Deserializer.deserialize_bytearray(response_data) - - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - 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() # 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 # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/utils.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/utils.py deleted file mode 100644 index 02aa2f816ea7..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_utils/utils.py +++ /dev/null @@ -1,18 +0,0 @@ -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_version.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_version.py deleted file mode 100644 index 9f6458b8cdac..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/_version.py +++ /dev/null @@ -1,3 +0,0 @@ -# coding=utf-8 - -VERSION = "1.0.0b1" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/__init__.py deleted file mode 100644 index 7eb42807ab0d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._client import UsageClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "UsageClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_client.py deleted file mode 100644 index 5afd7fc0bb8d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_client.py +++ /dev/null @@ -1,86 +0,0 @@ -# coding=utf-8 - -from copy import deepcopy -import sys -from typing import Any, Awaitable - -from corehttp.rest import AsyncHttpResponse, HttpRequest -from corehttp.runtime import AsyncPipelineClient, policies - -from .._utils.serialization import Deserializer, Serializer -from ._configuration import UsageClientConfiguration -from ._operations import _UsageClientOperationsMixin - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self # type: ignore - - -class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Illustrates usage of Record in different places(Operation parameters, return type or both). - - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str - """ - - def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any - ) -> None: - _endpoint = "{endpoint}" - self._config = UsageClientConfiguration(endpoint=endpoint, **kwargs) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.retry_policy, - self._config.authentication_policy, - self._config.logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(endpoint=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from corehttp.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~corehttp.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~corehttp.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_configuration.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_configuration.py deleted file mode 100644 index 876959eb1ed8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_configuration.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 - -from typing import Any - -from corehttp.runtime import policies - -from .._version import VERSION - - -class UsageClientConfiguration: - """Configuration for UsageClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Service host. Default value is "http://localhost:3000". - :type endpoint: str - """ - - def __init__(self, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "typetest-model-usage-typeddictonly/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/__init__.py deleted file mode 100644 index 1505a449ad48..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _UsageClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_operations.py deleted file mode 100644 index 8f26679b2ff1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_operations.py +++ /dev/null @@ -1,345 +0,0 @@ -# coding=utf-8 -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from corehttp.rest import AsyncHttpResponse, HttpRequest -from corehttp.runtime import AsyncPipelineClient -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.utils import case_insensitive_dict - -from ... import types -from ..._operations._operations import ( - build_usage_input_and_output_request, - build_usage_input_request, - build_usage_output_request, -) -from ..._utils.utils import ClientMixinABC -from .._configuration import UsageClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _UsageClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], UsageClientConfiguration] -): - - @overload - async def input(self, input: types.InputRecord, *, content_type: str = "application/json", **kwargs: Any) -> None: - """input. - - :param input: Required. - :type input: ~typetest.model.usage.typeddictonly.types.InputRecord - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - input = { - "requiredProp": "str" - } - """ - - @overload - async def input(self, input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """input. - - :param input: Required. - :type input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def input(self, input: Union[types.InputRecord, IO[bytes]], **kwargs: Any) -> None: - """input. - - :param input: Is either a InputRecord type or a IO[bytes] type. Required. - :type input: ~typetest.model.usage.typeddictonly.types.InputRecord or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - input = { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(input, (IOBase, bytes)): - _content = input - else: - _json = input - - _request = build_usage_input_request( - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def output(self, **kwargs: Any) -> types.OutputRecord: - """output. - - :return: OutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.OutputRecord - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[types.OutputRecord] = kwargs.pop("cls", None) - - _request = build_usage_output_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def input_and_output( - self, body: types.InputOutputRecord, *, content_type: str = "application/json", **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Required. - :type body: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "requiredProp": "str" - } - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - - @overload - async def input_and_output( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - - async def input_and_output( - self, body: Union[types.InputOutputRecord, IO[bytes]], **kwargs: Any - ) -> types.InputOutputRecord: - """input_and_output. - - :param body: Is either a InputOutputRecord type or a IO[bytes] type. Required. - :type body: ~typetest.model.usage.typeddictonly.types.InputOutputRecord or IO[bytes] - :return: InputOutputRecord - :rtype: ~typetest.model.usage.typeddictonly.types.InputOutputRecord - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "requiredProp": "str" - } - - # response body for status code(s): 200 - response == { - "requiredProp": "str" - } - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[types.InputOutputRecord] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = body - - _request = build_usage_input_and_output_request( - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_operations/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/aio/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/__init__.py deleted file mode 100644 index e895c08ad4bc..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding=utf-8 -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/_patch.py deleted file mode 100644 index bbe39eaf695d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/models/_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/py.typed b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/types.py deleted file mode 100644 index 492e8eb34ea9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage-typeddictonly/typetest/model/usage/typeddictonly/types.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class InputOutputRecord(TypedDict, total=False): - """Record used both as operation parameter and return type. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" - - -class InputRecord(TypedDict, total=False): - """Record used in operation parameters. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" - - -class OutputRecord(TypedDict, total=False): - """Record used in operation return type. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/types.py deleted file mode 100644 index 492e8eb34ea9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-usage/typetest/model/usage/types.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class InputOutputRecord(TypedDict, total=False): - """Record used both as operation parameter and return type. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" - - -class InputRecord(TypedDict, total=False): - """Record used in operation parameters. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" - - -class OutputRecord(TypedDict, total=False): - """Record used in operation return type. - - :ivar required_prop: Required. - :vartype required_prop: str - """ - - requiredProp: Required[str] - """Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/types.py deleted file mode 100644 index cc6ecea8a81a..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-model-visibility/typetest/model/visibility/types.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 - -from typing import Optional -from typing_extensions import Required, TypedDict - - -class ReadOnlyModel(TypedDict, total=False): - """RoundTrip model with readonly optional properties. - - :ivar optional_nullable_int_list: Optional readonly nullable int list. - :vartype optional_nullable_int_list: list[int] - :ivar optional_string_record: Optional readonly string dictionary. - :vartype optional_string_record: dict[str, str] - """ - - optionalNullableIntList: Optional[list[int]] - """Optional readonly nullable int list.""" - optionalStringRecord: dict[str, str] - """Optional readonly string dictionary.""" - - -class VisibilityModel(TypedDict, total=False): - """Output model with visibility properties. - - :ivar read_prop: Required string, illustrating a readonly property. Required. - :vartype read_prop: str - :ivar create_prop: Required string[], illustrating a create property. Required. - :vartype create_prop: list[str] - :ivar update_prop: Required int32[], illustrating a update property. Required. - :vartype update_prop: list[int] - :ivar delete_prop: Required bool, illustrating a delete property. Required. - :vartype delete_prop: bool - """ - - readProp: Required[str] - """Required string, illustrating a readonly property. Required.""" - createProp: Required[list[str]] - """Required string[], illustrating a create property. Required.""" - updateProp: Required[list[int]] - """Required int32[], illustrating a update property. Required.""" - deleteProp: Required[bool] - """Required bool, illustrating a delete property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/types.py deleted file mode 100644 index e55e1d5ebcb8..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/types.py +++ /dev/null @@ -1,457 +0,0 @@ -# coding=utf-8 - -import datetime -from typing import Literal, Union -from typing_extensions import Required, TypedDict - - -class DifferentSpreadFloatRecord(TypedDict, total=False): - """The model spread Record with the different known property type. - - :ivar name: The id property. Required. - :vartype name: str - """ - - name: Required[str] - """The id property. Required.""" - - -class DifferentSpreadFloatDerived(DifferentSpreadFloatRecord): - """The model extends from a model that spread Record with the different known property - type. - - :ivar name: The id property. Required. - :vartype name: str - :ivar derived_prop: The index property. Required. - :vartype derived_prop: float - """ - - derivedProp: Required[float] - """The index property. Required.""" - - -class DifferentSpreadModelArrayRecord(TypedDict, total=False): - """The model spread Record with the different known property type. - - :ivar known_prop: Required. - :vartype known_prop: str - """ - - knownProp: Required[str] - """Required.""" - - -class DifferentSpreadModelArrayDerived(DifferentSpreadModelArrayRecord): - """The model extends from a model that spread Record with the different known - property type. - - :ivar known_prop: Required. - :vartype known_prop: str - :ivar derived_prop: The index property. Required. - :vartype derived_prop: list[~typetest.property.additionalproperties.models.ModelForRecord] - """ - - derivedProp: Required[list["ModelForRecord"]] - """The index property. Required.""" - - -class DifferentSpreadModelRecord(TypedDict, total=False): - """The model spread Record with the different known property type. - - :ivar known_prop: Required. - :vartype known_prop: str - """ - - knownProp: Required[str] - """Required.""" - - -class DifferentSpreadModelDerived(DifferentSpreadModelRecord): - """The model extends from a model that spread Record with the different known - property type. - - :ivar known_prop: Required. - :vartype known_prop: str - :ivar derived_prop: The index property. Required. - :vartype derived_prop: ~typetest.property.additionalproperties.models.ModelForRecord - """ - - derivedProp: Required["ModelForRecord"] - """The index property. Required.""" - - -class DifferentSpreadStringRecord(TypedDict, total=False): - """The model spread Record with the different known property type. - - :ivar id: The name property. Required. - :vartype id: float - """ - - id: Required[float] - """The name property. Required.""" - - -class DifferentSpreadStringDerived(DifferentSpreadStringRecord): - """The model extends from a model that spread Record with the different known property - type. - - :ivar id: The name property. Required. - :vartype id: float - :ivar derived_prop: The index property. Required. - :vartype derived_prop: str - """ - - derivedProp: Required[str] - """The index property. Required.""" - - -class ExtendsFloatAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar id: The id property. Required. - :vartype id: float - """ - - id: Required[float] - """The id property. Required.""" - - -class ExtendsModelAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar known_prop: Required. - :vartype known_prop: ~typetest.property.additionalproperties.models.ModelForRecord - """ - - knownProp: Required["ModelForRecord"] - """Required.""" - - -class ExtendsModelArrayAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar known_prop: Required. - :vartype known_prop: list[~typetest.property.additionalproperties.models.ModelForRecord] - """ - - knownProp: Required[list["ModelForRecord"]] - """Required.""" - - -class ExtendsStringAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class ExtendsUnknownAdditionalProperties(TypedDict, total=False): - """The model extends from Record type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class ExtendsUnknownAdditionalPropertiesDerived(ExtendsUnknownAdditionalProperties): # pylint: disable=name-too-long - """The model extends from a type that extends from Record. - - :ivar name: The name property. Required. - :vartype name: str - :ivar index: The index property. Required. - :vartype index: int - :ivar age: The age property. - :vartype age: float - """ - - index: Required[int] - """The index property. Required.""" - age: float - """The age property.""" - - -class ExtendsUnknownAdditionalPropertiesDiscriminatedDerived(TypedDict, total=False): # pylint: disable=name-too-long - """The derived discriminated type. - - :ivar name: The name property. Required. - :vartype name: str - :ivar kind: Required. Default value is "derived". - :vartype kind: str - :ivar index: The index property. Required. - :vartype index: int - :ivar age: The age property. - :vartype age: float - """ - - name: Required[str] - """The name property. Required.""" - kind: Required[Literal["derived"]] - """Required. Default value is \"derived\".""" - index: Required[int] - """The index property. Required.""" - age: float - """The age property.""" - - -class IsFloatAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar id: The id property. Required. - :vartype id: float - """ - - id: Required[float] - """The id property. Required.""" - - -class IsModelAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar known_prop: Required. - :vartype known_prop: ~typetest.property.additionalproperties.models.ModelForRecord - """ - - knownProp: Required["ModelForRecord"] - """Required.""" - - -class IsModelArrayAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar known_prop: Required. - :vartype known_prop: list[~typetest.property.additionalproperties.models.ModelForRecord] - """ - - knownProp: Required[list["ModelForRecord"]] - """Required.""" - - -class IsStringAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class IsUnknownAdditionalProperties(TypedDict, total=False): - """The model is from Record type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class IsUnknownAdditionalPropertiesDerived(IsUnknownAdditionalProperties): - """The model extends from a type that is Record type. - - :ivar name: The name property. Required. - :vartype name: str - :ivar index: The index property. Required. - :vartype index: int - :ivar age: The age property. - :vartype age: float - """ - - index: Required[int] - """The index property. Required.""" - age: float - """The age property.""" - - -class IsUnknownAdditionalPropertiesDiscriminatedDerived(TypedDict, total=False): # pylint: disable=name-too-long - """The derived discriminated type. - - :ivar name: The name property. Required. - :vartype name: str - :ivar kind: Required. Default value is "derived". - :vartype kind: str - :ivar index: The index property. Required. - :vartype index: int - :ivar age: The age property. - :vartype age: float - """ - - name: Required[str] - """The name property. Required.""" - kind: Required[Literal["derived"]] - """Required. Default value is \"derived\".""" - index: Required[int] - """The index property. Required.""" - age: float - """The age property.""" - - -class ModelForRecord(TypedDict, total=False): - """model for record. - - :ivar state: The state property. Required. - :vartype state: str - """ - - state: Required[str] - """The state property. Required.""" - - -class MultipleSpreadRecord(TypedDict, total=False): - """The model spread Record and Record. - - :ivar flag: The name property. Required. - :vartype flag: bool - """ - - flag: Required[bool] - """The name property. Required.""" - - -class SpreadFloatRecord(TypedDict, total=False): - """The model spread Record with the same known property type. - - :ivar id: The id property. Required. - :vartype id: float - """ - - id: Required[float] - """The id property. Required.""" - - -class SpreadModelArrayRecord(TypedDict, total=False): - """SpreadModelArrayRecord. - - :ivar known_prop: Required. - :vartype known_prop: list[~typetest.property.additionalproperties.models.ModelForRecord] - """ - - knownProp: Required[list["ModelForRecord"]] - """Required.""" - - -class SpreadModelRecord(TypedDict, total=False): - """The model spread Record with the same known property type. - - :ivar known_prop: Required. - :vartype known_prop: ~typetest.property.additionalproperties.models.ModelForRecord - """ - - knownProp: Required["ModelForRecord"] - """Required.""" - - -class SpreadRecordForNonDiscriminatedUnion(TypedDict, total=False): - """The model spread Record. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class SpreadRecordForNonDiscriminatedUnion2(TypedDict, total=False): - """The model spread Record. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class SpreadRecordForNonDiscriminatedUnion3(TypedDict, total=False): - """The model spread Record. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class SpreadRecordForUnion(TypedDict, total=False): - """The model spread Record. - - :ivar flag: The name property. Required. - :vartype flag: bool - """ - - flag: Required[bool] - """The name property. Required.""" - - -class SpreadStringRecord(TypedDict, total=False): - """The model spread Record with the same known property type. - - :ivar name: The name property. Required. - :vartype name: str - """ - - name: Required[str] - """The name property. Required.""" - - -class WidgetData0(TypedDict, total=False): - """WidgetData0. - - :ivar kind: Required. Default value is "kind0". - :vartype kind: str - :ivar foo_prop: Required. - :vartype foo_prop: str - """ - - kind: Required[Literal["kind0"]] - """Required. Default value is \"kind0\".""" - fooProp: Required[str] - """Required.""" - - -class WidgetData1(TypedDict, total=False): - """WidgetData1. - - :ivar kind: Required. Default value is "kind1". - :vartype kind: str - :ivar start: Required. - :vartype start: ~datetime.datetime - :ivar end: - :vartype end: ~datetime.datetime - """ - - kind: Required[Literal["kind1"]] - """Required. Default value is \"kind1\".""" - start: Required[datetime.datetime] - """Required.""" - end: datetime.datetime - - -class WidgetData2(TypedDict, total=False): - """WidgetData2. - - :ivar kind: Required. Default value is "kind1". - :vartype kind: str - :ivar start: Required. - :vartype start: str - """ - - kind: Required[Literal["kind1"]] - """Required. Default value is \"kind1\".""" - start: Required[str] - """Required.""" - - -ExtendsUnknownAdditionalPropertiesDiscriminated = Union[ExtendsUnknownAdditionalPropertiesDiscriminatedDerived] -IsUnknownAdditionalPropertiesDiscriminated = Union[IsUnknownAdditionalPropertiesDiscriminatedDerived] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/types.py deleted file mode 100644 index f63c5f7736ab..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-nullable/typetest/property/nullable/types.py +++ /dev/null @@ -1,123 +0,0 @@ -# coding=utf-8 - -import datetime -from typing import Optional -from typing_extensions import Required, TypedDict - - -class BytesProperty(TypedDict, total=False): - """Template type for testing models with nullable property. Pass in the type of the property you - are looking for. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: bytes - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[bytes]] - """Property. Required.""" - - -class CollectionsByteProperty(TypedDict, total=False): - """Model with collection bytes properties. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: list[bytes] - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[list[bytes]]] - """Property. Required.""" - - -class CollectionsModelProperty(TypedDict, total=False): - """Model with collection models properties. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: list[~typetest.property.nullable.models.InnerModel] - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[list["InnerModel"]]] - """Property. Required.""" - - -class CollectionsStringProperty(TypedDict, total=False): - """Model with collection string properties. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: list[str] - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[list[str]]] - """Property. Required.""" - - -class DatetimeProperty(TypedDict, total=False): - """Model with a datetime property. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: ~datetime.datetime - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[datetime.datetime]] - """Property. Required.""" - - -class DurationProperty(TypedDict, total=False): - """Model with a duration property. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: ~datetime.timedelta - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[datetime.timedelta]] - """Property. Required.""" - - -class InnerModel(TypedDict, total=False): - """Inner model used in collections model property. - - :ivar property: Inner model property. Required. - :vartype property: str - """ - - property: Required[str] - """Inner model property. Required.""" - - -class StringProperty(TypedDict, total=False): - """Template type for testing models with nullable property. Pass in the type of the property you - are looking for. - - :ivar required_property: Required property. Required. - :vartype required_property: str - :ivar nullable_property: Property. Required. - :vartype nullable_property: str - """ - - requiredProperty: Required[str] - """Required property. Required.""" - nullableProperty: Required[Optional[str]] - """Property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/types.py deleted file mode 100644 index c87018e2008d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-optional/typetest/property/optional/types.py +++ /dev/null @@ -1,187 +0,0 @@ -# coding=utf-8 - -import datetime -from typing import Literal -from typing_extensions import Required, TypedDict - - -class BooleanLiteralProperty(TypedDict, total=False): - """Model with boolean literal property. - - :ivar property: Property. Default value is True. - :vartype property: bool - """ - - property: Literal[True] - """Property. Default value is True.""" - - -class BytesProperty(TypedDict, total=False): - """Template type for testing models with optional property. Pass in the type of the property you - are looking for. - - :ivar property: Property. - :vartype property: bytes - """ - - property: bytes - """Property.""" - - -class CollectionsByteProperty(TypedDict, total=False): - """Model with collection bytes properties. - - :ivar property: Property. - :vartype property: list[bytes] - """ - - property: list[bytes] - """Property.""" - - -class CollectionsModelProperty(TypedDict, total=False): - """Model with collection models properties. - - :ivar property: Property. - :vartype property: list[~typetest.property.optional.models.StringProperty] - """ - - property: list["StringProperty"] - """Property.""" - - -class DatetimeProperty(TypedDict, total=False): - """Model with a datetime property. - - :ivar property: Property. - :vartype property: ~datetime.datetime - """ - - property: datetime.datetime - """Property.""" - - -class DurationProperty(TypedDict, total=False): - """Model with a duration property. - - :ivar property: Property. - :vartype property: ~datetime.timedelta - """ - - property: datetime.timedelta - """Property.""" - - -class FloatLiteralProperty(TypedDict, total=False): - """Model with float literal property. - - :ivar property: Property. Default value is 1.25. - :vartype property: float - """ - - property: float - """Property. Default value is 1.25.""" - - -class IntLiteralProperty(TypedDict, total=False): - """Model with int literal property. - - :ivar property: Property. Default value is 1. - :vartype property: int - """ - - property: Literal[1] - """Property. Default value is 1.""" - - -class PlainDateProperty(TypedDict, total=False): - """Model with a plainDate property. - - :ivar property: Property. - :vartype property: ~datetime.date - """ - - property: datetime.date - """Property.""" - - -class PlainTimeProperty(TypedDict, total=False): - """Model with a plainTime property. - - :ivar property: Property. - :vartype property: ~datetime.time - """ - - property: datetime.time - """Property.""" - - -class RequiredAndOptionalProperty(TypedDict, total=False): - """Model with required and optional properties. - - :ivar optional_property: optional string property. - :vartype optional_property: str - :ivar required_property: required int property. Required. - :vartype required_property: int - """ - - optionalProperty: str - """optional string property.""" - requiredProperty: Required[int] - """required int property. Required.""" - - -class StringLiteralProperty(TypedDict, total=False): - """Model with string literal property. - - :ivar property: Property. Default value is "hello". - :vartype property: str - """ - - property: Literal["hello"] - """Property. Default value is \"hello\".""" - - -class StringProperty(TypedDict, total=False): - """Template type for testing models with optional property. Pass in the type of the property you - are looking for. - - :ivar property: Property. - :vartype property: str - """ - - property: str - """Property.""" - - -class UnionFloatLiteralProperty(TypedDict, total=False): - """Model with union of float literal property. - - :ivar property: Property. Is one of the following types: float - :vartype property: float or float - """ - - property: float - """Property. Is one of the following types: float""" - - -class UnionIntLiteralProperty(TypedDict, total=False): - """Model with union of int literal property. - - :ivar property: Property. Is either a Literal[1] type or a Literal[2] type. - :vartype property: int or int - """ - - property: Literal[1, 2] - """Property. Is either a Literal[1] type or a Literal[2] type.""" - - -class UnionStringLiteralProperty(TypedDict, total=False): - """Model with union of string literal property. - - :ivar property: Property. Is either a Literal["hello"] type or a Literal["world"] type. - :vartype property: str or str - """ - - property: Literal["hello", "world"] - """Property. Is either a Literal[\"hello\"] type or a Literal[\"world\"] type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/types.py deleted file mode 100644 index 2e7284054217..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/types.py +++ /dev/null @@ -1,336 +0,0 @@ -# coding=utf-8 - -import datetime -import decimal -from typing import Any, Literal, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -from .models._enums import ExtendedEnum - -if TYPE_CHECKING: - from .models import FixedInnerEnum, InnerEnum - - -class BooleanLiteralProperty(TypedDict, total=False): - """Model with a boolean literal property. - - :ivar property: Property. Required. Default value is True. - :vartype property: bool - """ - - property: Required[Literal[True]] - """Property. Required. Default value is True.""" - - -class BooleanProperty(TypedDict, total=False): - """Model with a boolean property. - - :ivar property: Property. Required. - :vartype property: bool - """ - - property: Required[bool] - """Property. Required.""" - - -class BytesProperty(TypedDict, total=False): - """Model with a bytes property. - - :ivar property: Property. Required. - :vartype property: bytes - """ - - property: Required[bytes] - """Property. Required.""" - - -class CollectionsIntProperty(TypedDict, total=False): - """Model with collection int properties. - - :ivar property: Property. Required. - :vartype property: list[int] - """ - - property: Required[list[int]] - """Property. Required.""" - - -class CollectionsModelProperty(TypedDict, total=False): - """Model with collection model properties. - - :ivar property: Property. Required. - :vartype property: list[~typetest.property.valuetypes.models.InnerModel] - """ - - property: Required[list["InnerModel"]] - """Property. Required.""" - - -class CollectionsStringProperty(TypedDict, total=False): - """Model with collection string properties. - - :ivar property: Property. Required. - :vartype property: list[str] - """ - - property: Required[list[str]] - """Property. Required.""" - - -class DatetimeProperty(TypedDict, total=False): - """Model with a datetime property. - - :ivar property: Property. Required. - :vartype property: ~datetime.datetime - """ - - property: Required[datetime.datetime] - """Property. Required.""" - - -class Decimal128Property(TypedDict, total=False): - """Model with a decimal128 property. - - :ivar property: Property. Required. - :vartype property: ~decimal.Decimal - """ - - property: Required[decimal.Decimal] - """Property. Required.""" - - -class DecimalProperty(TypedDict, total=False): - """Model with a decimal property. - - :ivar property: Property. Required. - :vartype property: ~decimal.Decimal - """ - - property: Required[decimal.Decimal] - """Property. Required.""" - - -class DictionaryStringProperty(TypedDict, total=False): - """Model with dictionary string properties. - - :ivar property: Property. Required. - :vartype property: dict[str, str] - """ - - property: Required[dict[str, str]] - """Property. Required.""" - - -class DurationProperty(TypedDict, total=False): - """Model with a duration property. - - :ivar property: Property. Required. - :vartype property: ~datetime.timedelta - """ - - property: Required[datetime.timedelta] - """Property. Required.""" - - -class EnumProperty(TypedDict, total=False): - """Model with enum properties. - - :ivar property: Property. Required. Known values are: "ValueOne" and "ValueTwo". - :vartype property: str or ~typetest.property.valuetypes.models.FixedInnerEnum - """ - - property: Required[Union[str, "FixedInnerEnum"]] - """Property. Required. Known values are: \"ValueOne\" and \"ValueTwo\".""" - - -class ExtensibleEnumProperty(TypedDict, total=False): - """Model with extensible enum properties. - - :ivar property: Property. Required. Known values are: "ValueOne" and "ValueTwo". - :vartype property: str or ~typetest.property.valuetypes.models.InnerEnum - """ - - property: Required[Union[str, "InnerEnum"]] - """Property. Required. Known values are: \"ValueOne\" and \"ValueTwo\".""" - - -class FloatLiteralProperty(TypedDict, total=False): - """Model with a float literal property. - - :ivar property: Property. Required. Default value is 43.125. - :vartype property: float - """ - - property: Required[float] - """Property. Required. Default value is 43.125.""" - - -class FloatProperty(TypedDict, total=False): - """Model with a float property. - - :ivar property: Property. Required. - :vartype property: float - """ - - property: Required[float] - """Property. Required.""" - - -class InnerModel(TypedDict, total=False): - """Inner model. Will be a property type for ModelWithModelProperties. - - :ivar property: Required string property. Required. - :vartype property: str - """ - - property: Required[str] - """Required string property. Required.""" - - -class IntLiteralProperty(TypedDict, total=False): - """Model with a int literal property. - - :ivar property: Property. Required. Default value is 42. - :vartype property: int - """ - - property: Required[Literal[42]] - """Property. Required. Default value is 42.""" - - -class IntProperty(TypedDict, total=False): - """Model with a int property. - - :ivar property: Property. Required. - :vartype property: int - """ - - property: Required[int] - """Property. Required.""" - - -class ModelProperty(TypedDict, total=False): - """Model with model properties. - - :ivar property: Property. Required. - :vartype property: ~typetest.property.valuetypes.models.InnerModel - """ - - property: Required["InnerModel"] - """Property. Required.""" - - -class NeverProperty(TypedDict, total=False): - """Model with a property never. (This property should not be included).""" - - -class StringLiteralProperty(TypedDict, total=False): - """Model with a string literal property. - - :ivar property: Property. Required. Default value is "hello". - :vartype property: str - """ - - property: Required[Literal["hello"]] - """Property. Required. Default value is \"hello\".""" - - -class StringProperty(TypedDict, total=False): - """Model with a string property. - - :ivar property: Property. Required. - :vartype property: str - """ - - property: Required[str] - """Property. Required.""" - - -class UnionEnumValueProperty(TypedDict, total=False): - """Template type for testing models with specific properties. Pass in the type of the property you - are looking for. - - :ivar property: Property. Required. ENUM_VALUE2. - :vartype property: str or ~typetest.property.valuetypes.models.ENUM_VALUE2 - """ - - property: Required[Literal[ExtendedEnum.ENUM_VALUE2]] - """Property. Required. ENUM_VALUE2.""" - - -class UnionFloatLiteralProperty(TypedDict, total=False): - """Model with a union of float literal as property. - - :ivar property: Property. Required. Is one of the following types: float - :vartype property: float or float - """ - - property: Required[float] - """Property. Required. Is one of the following types: float""" - - -class UnionIntLiteralProperty(TypedDict, total=False): - """Model with a union of int literal as property. - - :ivar property: Property. Required. Is either a Literal[42] type or a Literal[43] type. - :vartype property: int or int - """ - - property: Required[Literal[42, 43]] - """Property. Required. Is either a Literal[42] type or a Literal[43] type.""" - - -class UnionStringLiteralProperty(TypedDict, total=False): - """Model with a union of string literal as property. - - :ivar property: Property. Required. Is either a Literal["hello"] type or a Literal["world"] - type. - :vartype property: str or str - """ - - property: Required[Literal["hello", "world"]] - """Property. Required. Is either a Literal[\"hello\"] type or a Literal[\"world\"] type.""" - - -class UnknownArrayProperty(TypedDict, total=False): - """Model with a property unknown, and the data is an array. - - :ivar property: Property. Required. - :vartype property: any - """ - - property: Required[Any] - """Property. Required.""" - - -class UnknownDictProperty(TypedDict, total=False): - """Model with a property unknown, and the data is a dictionnary. - - :ivar property: Property. Required. - :vartype property: any - """ - - property: Required[Any] - """Property. Required.""" - - -class UnknownIntProperty(TypedDict, total=False): - """Model with a property unknown, and the data is a int32. - - :ivar property: Property. Required. - :vartype property: any - """ - - property: Required[Any] - """Property. Required.""" - - -class UnknownStringProperty(TypedDict, total=False): - """Model with a property unknown, and the data is a string. - - :ivar property: Property. Required. - :vartype property: any - """ - - property: Required[Any] - """Property. Required.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/types.py deleted file mode 100644 index 117f23bb7eba..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/typetest-union/typetest/union/types.py +++ /dev/null @@ -1,242 +0,0 @@ -# coding=utf-8 - -import builtins -from typing import Literal, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from .models import StringExtensibleNamedUnion - - -class Cat(TypedDict, total=False): - """Cat. - - :ivar name: Required. - :vartype name: str - """ - - name: Required[str] - """Required.""" - - -class Dog(TypedDict, total=False): - """Dog. - - :ivar bark: Required. - :vartype bark: str - """ - - bark: Required[str] - """Required.""" - - -class EnumsOnlyCases(TypedDict, total=False): - """EnumsOnlyCases. - - :ivar lr: This should be receive/send the left variant. Required. Is one of the following - types: Literal["left"], Literal["right"], Literal["up"], Literal["down"] - :vartype lr: str or str or str or str - :ivar ud: This should be receive/send the up variant. Required. Is either a Literal["up"] type - or a Literal["down"] type. - :vartype ud: str or str - """ - - lr: Required[Literal["left", "right", "up", "down"]] - """This should be receive/send the left variant. Required. Is one of the following types: - Literal[\"left\"], Literal[\"right\"], Literal[\"up\"], Literal[\"down\"]""" - ud: Required[Literal["up", "down"]] - """This should be receive/send the up variant. Required. Is either a Literal[\"up\"] type or a - Literal[\"down\"] type.""" - - -class GetResponse(TypedDict, total=False): - """GetResponse. - - :ivar prop: Required. Is one of the following types: Literal["a"], Literal["b"], Literal["c"] - :vartype prop: str or str or str - """ - - prop: Required[Literal["a", "b", "c"]] - """Required. Is one of the following types: Literal[\"a\"], Literal[\"b\"], Literal[\"c\"]""" - - -class GetResponse1(TypedDict, total=False): - """GetResponse1. - - :ivar prop: Required. Is one of the following types: Literal["b"], Literal["c"], str - :vartype prop: str or str or str - """ - - prop: Required[Union[Literal["b"], Literal["c"], str]] - """Required. Is one of the following types: Literal[\"b\"], Literal[\"c\"], str""" - - -class GetResponse2(TypedDict, total=False): - """GetResponse2. - - :ivar prop: Required. Known values are: "b" and "c". - :vartype prop: str or ~typetest.union.models.StringExtensibleNamedUnion - """ - - prop: Required[Union[str, "StringExtensibleNamedUnion"]] - """Required. Known values are: \"b\" and \"c\".""" - - -class GetResponse3(TypedDict, total=False): - """GetResponse3. - - :ivar prop: Required. Is one of the following types: Literal[1], Literal[2], Literal[3] - :vartype prop: int or int or int - """ - - prop: Required[Literal[1, 2, 3]] - """Required. Is one of the following types: Literal[1], Literal[2], Literal[3]""" - - -class GetResponse4(TypedDict, total=False): - """GetResponse4. - - :ivar prop: Required. Is one of the following types: float - :vartype prop: float or float or float - """ - - prop: Required[float] - """Required. Is one of the following types: float""" - - -class GetResponse5(TypedDict, total=False): - """GetResponse5. - - :ivar prop: Required. Is either a Cat type or a Dog type. - :vartype prop: ~typetest.union.models.Cat or ~typetest.union.models.Dog - """ - - prop: Required[Union["Cat", "Dog"]] - """Required. Is either a Cat type or a Dog type.""" - - -class GetResponse6(TypedDict, total=False): - """GetResponse6. - - :ivar prop: Required. - :vartype prop: ~typetest.union.models.EnumsOnlyCases - """ - - prop: Required["EnumsOnlyCases"] - """Required.""" - - -class GetResponse7(TypedDict, total=False): - """GetResponse7. - - :ivar prop: Required. - :vartype prop: ~typetest.union.models.StringAndArrayCases - """ - - prop: Required["StringAndArrayCases"] - """Required.""" - - -class GetResponse8(TypedDict, total=False): - """GetResponse8. - - :ivar prop: Required. - :vartype prop: ~typetest.union.models.MixedLiteralsCases - """ - - prop: Required["MixedLiteralsCases"] - """Required.""" - - -class GetResponse9(TypedDict, total=False): - """GetResponse9. - - :ivar prop: Required. - :vartype prop: ~typetest.union.models.MixedTypesCases - """ - - prop: Required["MixedTypesCases"] - """Required.""" - - -class MixedLiteralsCases(TypedDict, total=False): - """MixedLiteralsCases. - - :ivar string_literal: This should be receive/send the "a" variant. Required. Is one of the - following types: Literal["a"], Literal[2], float, Literal[True] - :vartype string_literal: str or int or float or bool - :ivar int_literal: This should be receive/send the 2 variant. Required. Is one of the following - types: Literal["a"], Literal[2], float, Literal[True] - :vartype int_literal: str or int or float or bool - :ivar float_literal: This should be receive/send the 3.3 variant. Required. Is one of the - following types: Literal["a"], Literal[2], float, Literal[True] - :vartype float_literal: str or int or float or bool - :ivar boolean_literal: This should be receive/send the true variant. Required. Is one of the - following types: Literal["a"], Literal[2], float, Literal[True] - :vartype boolean_literal: str or int or float or bool - """ - - stringLiteral: Required[Literal["a", 2, True]] - """This should be receive/send the \"a\" variant. Required. Is one of the following types: - Literal[\"a\"], Literal[2], float, Literal[True]""" - intLiteral: Required[Literal["a", 2, True]] - """This should be receive/send the 2 variant. Required. Is one of the following types: - Literal[\"a\"], Literal[2], float, Literal[True]""" - floatLiteral: Required[Literal["a", 2, True]] - """This should be receive/send the 3.3 variant. Required. Is one of the following types: - Literal[\"a\"], Literal[2], float, Literal[True]""" - booleanLiteral: Required[Literal["a", 2, True]] - """This should be receive/send the true variant. Required. Is one of the following types: - Literal[\"a\"], Literal[2], float, Literal[True]""" - - -class MixedTypesCases(TypedDict, total=False): - """MixedTypesCases. - - :ivar model: This should be receive/send the Cat variant. Required. Is one of the following - types: Cat, Literal["a"], int, bool - :vartype model: ~typetest.union.models.Cat or str or int or bool - :ivar literal: This should be receive/send the "a" variant. Required. Is one of the following - types: Cat, Literal["a"], int, bool - :vartype literal: ~typetest.union.models.Cat or str or int or bool - :ivar int_property: This should be receive/send the int variant. Required. Is one of the - following types: Cat, Literal["a"], int, bool - :vartype int_property: ~typetest.union.models.Cat or str or int or bool - :ivar boolean: This should be receive/send the boolean variant. Required. Is one of the - following types: Cat, Literal["a"], int, bool - :vartype boolean: ~typetest.union.models.Cat or str or int or bool - :ivar array: This should be receive/send 4 element with Cat, "a", int, and boolean. Required. - :vartype array: list[~typetest.union.models.Cat or str or int or bool] - """ - - model: Required[Union["Cat", Literal["a"], builtins.int, bool]] - """This should be receive/send the Cat variant. Required. Is one of the following types: Cat, - Literal[\"a\"], int, bool""" - literal: Required[Union["Cat", Literal["a"], builtins.int, bool]] - """This should be receive/send the \"a\" variant. Required. Is one of the following types: Cat, - Literal[\"a\"], int, bool""" - int: Required[Union["Cat", Literal["a"], builtins.int, bool]] - """This should be receive/send the int variant. Required. Is one of the following types: Cat, - Literal[\"a\"], int, bool""" - boolean: Required[Union["Cat", Literal["a"], builtins.int, bool]] - """This should be receive/send the boolean variant. Required. Is one of the following types: Cat, - Literal[\"a\"], int, bool""" - array: Required[list[Union["Cat", Literal["a"], builtins.int, bool]]] - """This should be receive/send 4 element with Cat, \"a\", int, and boolean. Required.""" - - -class StringAndArrayCases(TypedDict, total=False): - """StringAndArrayCases. - - :ivar string: This should be receive/send the string variant. Required. Is either a str type or - a [str] type. - :vartype string: str or list[str] - :ivar array: This should be receive/send the array variant. Required. Is either a str type or a - [str] type. - :vartype array: str or list[str] - """ - - string: Required[Union[str, list[str]]] - """This should be receive/send the string variant. Required. Is either a str type or a [str] type.""" - array: Required[Union[str, list[str]]] - """This should be receive/send the array variant. Required. Is either a str type or a [str] type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/_unions.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/_unions.py deleted file mode 100644 index 45f53499c1a1..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/_unions.py +++ /dev/null @@ -1,6 +0,0 @@ -# coding=utf-8 - -from typing import Union - -UnionV2 = Union[str, int] -UnionV1 = Union[str, int] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/types.py deleted file mode 100644 index ae4846c5a7ab..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-added/versioning/added/types.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from . import _unions - from .models import EnumV1, EnumV2 - - -class ModelV1(TypedDict, total=False): - """ModelV1. - - :ivar prop: Required. - :vartype prop: str - :ivar enum_prop: Required. Known values are: "enumMemberV1" and "enumMemberV2". - :vartype enum_prop: str or ~versioning.added.models.EnumV1 - :ivar union_prop: Required. Is either a str type or a int type. - :vartype union_prop: str or int - """ - - prop: Required[str] - """Required.""" - enumProp: Required[Union[str, "EnumV1"]] - """Required. Known values are: \"enumMemberV1\" and \"enumMemberV2\".""" - unionProp: Required["_unions.UnionV1"] - """Required. Is either a str type or a int type.""" - - -class ModelV2(TypedDict, total=False): - """ModelV2. - - :ivar prop: Required. - :vartype prop: str - :ivar enum_prop: Required. "enumMember" - :vartype enum_prop: str or ~versioning.added.models.EnumV2 - :ivar union_prop: Required. Is either a str type or a int type. - :vartype union_prop: str or int - """ - - prop: Required[str] - """Required.""" - enumProp: Required[Union[str, "EnumV2"]] - """Required. \"enumMember\"""" - unionProp: Required["_unions.UnionV2"] - """Required. Is either a str type or a int type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/types.py deleted file mode 100644 index d23eac46987f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-madeoptional/versioning/madeoptional/types.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class TestModel(TypedDict, total=False): - """TestModel. - - :ivar prop: Required. - :vartype prop: str - :ivar changed_prop: - :vartype changed_prop: str - """ - - prop: Required[str] - """Required.""" - changedProp: str diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_unions.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_unions.py deleted file mode 100644 index d8bb21ff55f9..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/_unions.py +++ /dev/null @@ -1,5 +0,0 @@ -# coding=utf-8 - -from typing import Union - -UnionV2 = Union[str, float] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/types.py deleted file mode 100644 index 0144f3821d40..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-removed/versioning/removed/types.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from . import _unions - from .models import EnumV2, EnumV3 - - -class ModelV2(TypedDict, total=False): - """ModelV2. - - :ivar prop: Required. - :vartype prop: str - :ivar enum_prop: Required. "enumMemberV2" - :vartype enum_prop: str or ~versioning.removed.models.EnumV2 - :ivar union_prop: Required. Is either a str type or a float type. - :vartype union_prop: str or float - """ - - prop: Required[str] - """Required.""" - enumProp: Required[Union[str, "EnumV2"]] - """Required. \"enumMemberV2\"""" - unionProp: Required["_unions.UnionV2"] - """Required. Is either a str type or a float type.""" - - -class ModelV3(TypedDict, total=False): - """ModelV3. - - :ivar id: Required. - :vartype id: str - :ivar enum_prop: Required. Known values are: "enumMemberV1" and "enumMemberV2Preview". - :vartype enum_prop: str or ~versioning.removed.models.EnumV3 - """ - - id: Required[str] - """Required.""" - enumProp: Required[Union[str, "EnumV3"]] - """Required. Known values are: \"enumMemberV1\" and \"enumMemberV2Preview\".""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_unions.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_unions.py deleted file mode 100644 index b302e8524e9f..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_unions.py +++ /dev/null @@ -1,5 +0,0 @@ -# coding=utf-8 - -from typing import Union - -NewUnion = Union[str, int] diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/types.py deleted file mode 100644 index fec7960a4a4d..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/types.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 - -from typing import TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict - -if TYPE_CHECKING: - from . import _unions - from .models import NewEnum - - -class NewModel(TypedDict, total=False): - """NewModel. - - :ivar new_prop: Required. - :vartype new_prop: str - :ivar enum_prop: Required. "newEnumMember" - :vartype enum_prop: str or ~versioning.renamedfrom.models.NewEnum - :ivar union_prop: Required. Is either a str type or a int type. - :vartype union_prop: str or int - """ - - newProp: Required[str] - """Required.""" - enumProp: Required[Union[str, "NewEnum"]] - """Required. \"newEnumMember\"""" - unionProp: Required["_unions.NewUnion"] - """Required. Is either a str type or a int type.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/CHANGELOG.md b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/CHANGELOG.md index 628743d283a9..b957b2575b48 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/CHANGELOG.md +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/CHANGELOG.md @@ -2,4 +2,6 @@ ## 1.0.0b1 (1970-01-01) -- Initial version +### Other Changes + + - Initial version \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py index e9ae92835196..bbe39eaf695d 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py @@ -5,9 +5,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/types.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/types.py deleted file mode 100644 index 0bddeba9fdd0..000000000000 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/types.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 - -from typing_extensions import Required, TypedDict - - -class TestModel(TypedDict, total=False): - """TestModel. - - :ivar prop: Required. - :vartype prop: str - :ivar changed_prop: Required. - :vartype changed_prop: str - """ - - prop: Required[str] - """Required.""" - changedProp: Required[str] - """Required."""