From 1ddb213683c86a635726d70282bb2ba1c3cac350 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 28 Oct 2021 12:57:00 -0700 Subject: [PATCH 01/23] fix logic for is json? --- autorest/codegen/models/parameter.py | 4 +++ .../models/request_builder_parameter_list.py | 34 +++++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/autorest/codegen/models/parameter.py b/autorest/codegen/models/parameter.py index caaeed7b378..f9c3506a030 100644 --- a/autorest/codegen/models/parameter.py +++ b/autorest/codegen/models/parameter.py @@ -151,6 +151,10 @@ def constant_declaration(self) -> str: ) raise ValueError("Trying to get a declaration for a schema that doesn't exist") + @property + def serialization_formats(self) -> List[str]: + return self.yaml_data.get('serializationFormats', []) + @property def xml_serialization_ctxt(self) -> str: return self.schema.xml_serialization_ctxt() or "" diff --git a/autorest/codegen/models/request_builder_parameter_list.py b/autorest/codegen/models/request_builder_parameter_list.py index 66d9df1016c..13d5acbea59 100644 --- a/autorest/codegen/models/request_builder_parameter_list.py +++ b/autorest/codegen/models/request_builder_parameter_list.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +import re from copy import copy from typing import List, Optional, TypeVar, Dict from .request_builder_parameter import RequestBuilderParameter @@ -18,6 +19,21 @@ _REQUEST_BUILDER_BODY_NAMES = ["files", "json", "content", "data"] +def _is_json(schema_requests: List[SchemaRequest], body_method_param: Parameter) -> bool: + if 'json' in body_method_param.serialization_formats: + return True + if any( + sr for sr in schema_requests + if sr.yaml_data.get("protocol", {}).get('http', {}).get('knownMediaType') == "json" + ): + return True + content_types = set( + m + for request in schema_requests + for m in request.media_types + ) + return any(c for c in content_types if re.compile(r'^(application|text)/([0-9a-z+.]+\+)?json$').match(c)) + class RequestBuilderParameterList(ParameterList): def __init__( @@ -43,6 +59,7 @@ def add_body_kwargs(self, schema_requests: List[SchemaRequest]) -> None: pass else: serialized_name: str = "" + if body_method_param.is_multipart: serialized_name = "files" file_kwarg = copy(body_method_param) @@ -73,16 +90,8 @@ def add_body_kwargs(self, schema_requests: List[SchemaRequest]) -> None: ) data_kwarg.is_data_input = False body_kwargs_added.append(data_kwarg) - if body_method_param.constant: - # we don't add body kwargs for constant bodies - if not serialized_name: - serialized_name = "json" if body_method_param.is_json_parameter else "content" - body_method_param.serialized_name = serialized_name - return - if ( - any(sr for sr in schema_requests if not sr.is_stream_request) and - any([ct for ct in self.content_types if "json" in ct]) - ): + if _is_json(schema_requests, body_method_param): + serialized_name = "json" json_kwarg = copy(body_method_param) self._change_body_param_name(json_kwarg, "json") json_kwarg.description = ( @@ -92,6 +101,11 @@ def add_body_kwargs(self, schema_requests: List[SchemaRequest]) -> None: ) json_kwarg.schema = AnySchema(namespace="", yaml_data={}) body_kwargs_added.append(json_kwarg) + if body_method_param.constant: + # we don't add body kwargs for constant bodies + serialized_name = serialized_name or "content" + body_method_param.serialized_name = serialized_name + return content_kwarg = copy(body_method_param) self._change_body_param_name(content_kwarg, "content") content_kwarg.schema = AnySchema(namespace="", yaml_data={}) From 7fe9dc11af173f30f513f8cf6d5e66ed7a42822c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 28 Oct 2021 13:13:45 -0700 Subject: [PATCH 02/23] regen media types with current implementation --- .../_media_types_client_operations.py | 62 ++++++++++++ .../MediaTypes/mediatypes/models/__init__.py | 2 + .../models/_media_types_client_enums.py | 9 ++ .../_media_types_client_operations.py | 90 ++++++++++++++++++ .../mediatypeslowlevel/rest/__init__.py | 3 + .../rest/_request_builders.py | 50 ++++++++++ .../rest/_request_builders_py3.py | 44 +++++++++ .../aio/operations/_operations.py | 66 +++++++++++++ .../operations/_operations.py | 94 +++++++++++++++++++ 9 files changed, 420 insertions(+) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py index ce9cebb33b3..d51899784c3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py @@ -26,6 +26,7 @@ from ...operations._media_types_client_operations import ( build_analyze_body_no_accept_header_request, build_analyze_body_request, + build_binary_body_with_multiple_content_types_request, build_content_type_with_encoding_request, ) @@ -198,3 +199,64 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs return deserialized content_type_with_encoding.metadata = {"url": "/mediatypes/contentTypeWithEncoding"} # type: ignore + + @distributed_trace_async + async def binary_body_with_multiple_content_types(self, message: Union[IO, str], **kwargs: Any) -> str: + """Binary body with three content types. They should be grouped by body type. + + :param message: The payload body. + :type message: IO or str + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "application/json", "application/octet-stream", + "text/plain." + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "text/plain") # type: Optional[Union[str, "_models.ContentType1"]] + + json = None + content = None + if content_type.split(";")[0] in ["application/json", "application/octet-stream"]: + content = message + elif content_type.split(";")[0] in ["text/plain"]: + json = self._serialize.body(message, "IO") + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) + ) + + request = build_binary_body_with_multiple_content_types_request( + content_type=content_type, + json=json, + content=content, + template_url=self.binary_body_with_multiple_content_types.metadata["url"], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py index fb0eedbdcde..79d9ce83bdc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py @@ -13,9 +13,11 @@ from ._media_types_client_enums import ( ContentType, + ContentType1, ) __all__ = [ "SourcePath", "ContentType", + "ContentType1", ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_media_types_client_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_media_types_client_enums.py index 3bc5bc7bd88..92056a414ae 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_media_types_client_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_media_types_client_enums.py @@ -22,3 +22,12 @@ class ContentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IMAGE_PNG = "image/png" #: Content Type 'image/tiff'. IMAGE_TIFF = "image/tiff" + + +class ContentType1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Content type for upload""" + + #: Content Type 'application/json'. + APPLICATION_JSON = "application/json" + #: Content Type 'application/octet-stream'. + APPLICATION_OCTET_STREAM = "application/octet-stream" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py index b115ad1a837..6fff03ff240 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py @@ -104,6 +104,30 @@ def build_content_type_with_encoding_request( **kwargs ) + +def build_binary_body_with_multiple_content_types_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[Union[str, "_models.ContentType1"]] + + accept = "text/plain, application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/mediatypes/binaryBody') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + # fmt: on class MediaTypesClientOperationsMixin(object): @distributed_trace @@ -283,3 +307,69 @@ def content_type_with_encoding( return deserialized content_type_with_encoding.metadata = {"url": "/mediatypes/contentTypeWithEncoding"} # type: ignore + + @distributed_trace + def binary_body_with_multiple_content_types( + self, + message, # type: Union[IO, str] + **kwargs # type: Any + ): + # type: (...) -> str + """Binary body with three content types. They should be grouped by body type. + + :param message: The payload body. + :type message: IO or str + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "application/json", "application/octet-stream", + "text/plain." + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "text/plain") # type: Optional[Union[str, "_models.ContentType1"]] + + json = None + content = None + if content_type.split(";")[0] in ["application/json", "application/octet-stream"]: + content = message + elif content_type.split(";")[0] in ["text/plain"]: + json = self._serialize.body(message, "IO") + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) + ) + + request = build_binary_body_with_multiple_content_types_request( + content_type=content_type, + json=json, + content=content, + template_url=self.binary_body_with_multiple_content_types.metadata["url"], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if response.status_code == 200: + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py index ac48306982b..8ef551340cd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py @@ -10,13 +10,16 @@ from ._request_builders_py3 import build_analyze_body_request from ._request_builders_py3 import build_analyze_body_no_accept_header_request from ._request_builders_py3 import build_content_type_with_encoding_request + from ._request_builders_py3 import build_binary_body_with_multiple_content_types_request except (SyntaxError, ImportError): from ._request_builders import build_analyze_body_request # type: ignore from ._request_builders import build_analyze_body_no_accept_header_request # type: ignore from ._request_builders import build_content_type_with_encoding_request # type: ignore + from ._request_builders import build_binary_body_with_multiple_content_types_request # type: ignore __all__ = [ "build_analyze_body_request", "build_analyze_body_no_accept_header_request", "build_content_type_with_encoding_request", + "build_binary_body_with_multiple_content_types_request", ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py index 57aca8a5af8..748ec0f0d16 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py @@ -157,3 +157,53 @@ def build_content_type_with_encoding_request( headers=header_parameters, **kwargs ) + + +def build_binary_body_with_multiple_content_types_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Binary body with three content types. They should be grouped by body type. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. The payload body. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). The payload body. + :paramtype content: any + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "application/json", "application/octet-stream", + "text/plain." + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = "str" # Optional. + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "text/plain, application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/mediatypes/binaryBody') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py index d9dffa89a3d..53058ec5566 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py @@ -128,3 +128,47 @@ def build_content_type_with_encoding_request(*, content: Any = None, **kwargs: A header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=url, headers=header_parameters, content=content, **kwargs) + + +def build_binary_body_with_multiple_content_types_request( + *, json: Any = None, content: Any = None, **kwargs: Any +) -> HttpRequest: + """Binary body with three content types. They should be grouped by body type. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. The payload body. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). The payload body. + :paramtype content: any + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "application/json", "application/octet-stream", + "text/plain." + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = "str" # Optional. + """ + + content_type = kwargs.pop("content_type", None) # type: Optional[str] + + accept = "text/plain, application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", "/mediatypes/binaryBody") + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py index e3e2d8ea3f4..60feefca231 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import ( build_analyze_body_no_accept_header_request, build_analyze_body_request, + build_binary_body_with_multiple_content_types_request, build_content_type_with_encoding_request, ) @@ -206,3 +207,68 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs return deserialized content_type_with_encoding.metadata = {"url": "/mediatypes/contentTypeWithEncoding"} # type: ignore + + @distributed_trace_async + async def binary_body_with_multiple_content_types(self, message: Union[IO, str], **kwargs: Any) -> str: + """Binary body with three content types. They should be grouped by body type. + + :param message: The payload body. + :type message: IO or str + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "application/json", "application/octet-stream", + "text/plain." + :return: str + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "text/plain") # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json", "application/octet-stream"]: + content = message + elif content_type.split(";")[0] in ["text/plain"]: + json = message + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) + ) + + request = build_binary_body_with_multiple_content_types_request( + content_type=content_type, + json=json, + content=content, + template_url=self.binary_body_with_multiple_content_types.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.status_code == 200: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 200: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py index d04d4dabfc8..878074db464 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py @@ -101,6 +101,30 @@ def build_content_type_with_encoding_request( **kwargs ) + +def build_binary_body_with_multiple_content_types_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "text/plain, application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/mediatypes/binaryBody') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + # fmt: on class MediaTypesClientOperationsMixin(object): @distributed_trace @@ -292,3 +316,73 @@ def content_type_with_encoding( return deserialized content_type_with_encoding.metadata = {"url": "/mediatypes/contentTypeWithEncoding"} # type: ignore + + @distributed_trace + def binary_body_with_multiple_content_types( + self, + message, # type: Union[IO, str] + **kwargs # type: Any + ): + # type: (...) -> str + """Binary body with three content types. They should be grouped by body type. + + :param message: The payload body. + :type message: IO or str + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "application/json", "application/octet-stream", + "text/plain." + :return: str + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "text/plain") # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json", "application/octet-stream"]: + content = message + elif content_type.split(";")[0] in ["text/plain"]: + json = message + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) + ) + + request = build_binary_body_with_multiple_content_types_request( + content_type=content_type, + json=json, + content=content, + template_url=self.binary_body_with_multiple_content_types.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.status_code == 200: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 200: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore From 21ef4b93e3f3bab48b21ecbe8651ef50873b38bd Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 28 Oct 2021 13:35:05 -0700 Subject: [PATCH 03/23] add content types onto base builders, rename all media types to content typess --- autorest/codegen/__init__.py | 2 +- autorest/codegen/models/base_builder.py | 40 +++++++++++++--- autorest/codegen/models/code_model.py | 8 ++-- autorest/codegen/models/lro_operation.py | 6 +-- autorest/codegen/models/operation.py | 37 +++++++++------ autorest/codegen/models/paging_operation.py | 4 +- autorest/codegen/models/parameter.py | 25 ++++++---- autorest/codegen/models/parameter_list.py | 46 ++----------------- autorest/codegen/models/request_builder.py | 7 +-- .../models/request_builder_parameter.py | 7 ++- .../models/request_builder_parameter_list.py | 2 +- autorest/codegen/models/schema_request.py | 12 ++--- autorest/codegen/models/schema_response.py | 8 ++-- .../codegen/serializers/builder_serializer.py | 12 ++--- test/unittests/test_optional_return_type.py | 37 +++++++-------- 15 files changed, 131 insertions(+), 122 deletions(-) diff --git a/autorest/codegen/__init__.py b/autorest/codegen/__init__.py index d9e05a47173..5ec83b69742 100644 --- a/autorest/codegen/__init__.py +++ b/autorest/codegen/__init__.py @@ -33,7 +33,7 @@ def _build_convenience_layer(yaml_data: Dict[str, Any], code_model: CodeModel) - if code_model.options["show_operations"]: code_model.link_operation_to_request_builder() code_model.add_schema_link_to_operation() - code_model.generate_single_parameter_from_multiple_media_types_operation() + code_model.generate_single_parameter_from_multiple_content_types_operation() # LRO operation code_model.format_lro_operations() code_model.remove_next_operation() diff --git a/autorest/codegen/models/base_builder.py b/autorest/codegen/models/base_builder.py index 928fed0b2cd..068cabf47fd 100644 --- a/autorest/codegen/models/base_builder.py +++ b/autorest/codegen/models/base_builder.py @@ -6,6 +6,7 @@ from typing import Any, Callable, Dict, List, Optional, Union, TYPE_CHECKING from .base_model import BaseModel from .schema_response import SchemaResponse +from .schema_request import SchemaRequest if TYPE_CHECKING: from . import ParameterListType @@ -16,7 +17,7 @@ def create_parameters(yaml_data: Dict[str, Any], code_model, parameter_creator: Callable): multiple_requests = len(yaml_data["requests"]) > 1 - multiple_media_type_parameters = [] + multiple_content_type_parameters = [] parameters = [parameter_creator(yaml, code_model=code_model) for yaml in yaml_data.get("parameters", [])] for request in yaml_data["requests"]: @@ -26,14 +27,14 @@ def create_parameters(yaml_data: Dict[str, Any], code_model, parameter_creator: if name in _M4_HEADER_PARAMETERS: parameters.append(parameter) elif multiple_requests: - parameter.has_multiple_media_types = True - multiple_media_type_parameters.append(parameter) + parameter.has_multiple_content_types = True + multiple_content_type_parameters.append(parameter) else: parameters.append(parameter) - if multiple_media_type_parameters: + if multiple_content_type_parameters: body_parameters_name_set = set( - p.serialized_name for p in multiple_media_type_parameters + p.serialized_name for p in multiple_content_type_parameters ) if len(body_parameters_name_set) > 1: raise ValueError( @@ -53,7 +54,7 @@ def create_parameters(yaml_data: Dict[str, Any], code_model, parameter_creator: if parameter_original_id in parameters_index: parameter.original_parameter = parameters_index[parameter_original_id] - return parameters, multiple_media_type_parameters + return parameters, multiple_content_type_parameters class BaseBuilder(BaseModel): """Base class for Operations and Request Builders""" @@ -65,6 +66,7 @@ def __init__( name: str, description: str, parameters: "ParameterListType", + schema_requests: List[SchemaRequest], responses: Optional[List[SchemaResponse]] = None, summary: Optional[str] = None, ) -> None: @@ -75,10 +77,26 @@ def __init__( self.parameters = parameters self.responses = responses or [] self.summary = summary + self.schema_requests = schema_requests + + @property + def default_content_type(self) -> str: + json_content_types = [c for c in self.content_types if "json" in c] + if json_content_types: + if "application/json" in json_content_types: + return "application/json" + return json_content_types[0] + + xml_content_types = [c for c in self.content_types if "xml" in c] + if xml_content_types: + if "application/xml" in xml_content_types: + return "application/xml" + return xml_content_types[0] + return self.content_types[0] @property def default_content_type_declaration(self) -> str: - return f'"{self.parameters.default_content_type}"' + return f'"{self.default_content_type}"' def get_response_from_status(self, status_code: Optional[Union[str, int]]) -> SchemaResponse: for response in self.responses: @@ -90,3 +108,11 @@ def get_response_from_status(self, status_code: Optional[Union[str, int]]) -> Sc def success_status_code(self) -> List[Union[str, int]]: """The list of all successfull status code.""" return [code for response in self.responses for code in response.status_codes if code != "default"] + + @property + def content_types(self) -> List[str]: + return list(set( + m + for request in self.schema_requests + for m in request.content_types + )) diff --git a/autorest/codegen/models/code_model.py b/autorest/codegen/models/code_model.py index ecfcc847e96..ddca92c04d7 100644 --- a/autorest/codegen/models/code_model.py +++ b/autorest/codegen/models/code_model.py @@ -316,7 +316,7 @@ def add_schema_link_to_operation(self) -> None: for operation in operation_group.operations: for obj in chain( operation.parameters, - operation.multiple_media_type_parameters or [], + operation.multiple_content_type_parameters or [], operation.responses, operation.exceptions, chain.from_iterable(response.headers for response in operation.responses), @@ -337,11 +337,11 @@ def add_schema_link_to_global_parameters(self) -> None: for parameter in self.global_parameters: self._populate_schema(parameter) - def generate_single_parameter_from_multiple_media_types_operation(self) -> None: + def generate_single_parameter_from_multiple_content_types_operation(self) -> None: for operation_group in self.operation_groups: for operation in operation_group.operations: - if operation.multiple_media_type_parameters: - operation.convert_multiple_media_type_parameters() + if operation.multiple_content_type_parameters: + operation.convert_multiple_content_type_parameters() @property def need_vendored_code(self) -> bool: diff --git a/autorest/codegen/models/lro_operation.py b/autorest/codegen/models/lro_operation.py index 16f9804f7f3..6fba4d7050c 100644 --- a/autorest/codegen/models/lro_operation.py +++ b/autorest/codegen/models/lro_operation.py @@ -24,7 +24,7 @@ def __init__( description: str, api_versions: Set[str], parameters: ParameterList, - multiple_media_type_parameters: ParameterList, + multiple_content_type_parameters: ParameterList, summary: Optional[str] = None, responses: Optional[List[SchemaResponse]] = None, exceptions: Optional[List[SchemaResponse]] = None, @@ -38,7 +38,7 @@ def __init__( description, api_versions, parameters, - multiple_media_type_parameters, + multiple_content_type_parameters, summary, responses, exceptions, @@ -86,7 +86,7 @@ def initial_operation(self) -> Operation: description="", api_versions=self.api_versions, parameters=self.parameters, - multiple_media_type_parameters=self.multiple_media_type_parameters, + multiple_content_type_parameters=self.multiple_content_type_parameters, summary=self.summary, responses=self.responses, want_description_docstring=False, diff --git a/autorest/codegen/models/operation.py b/autorest/codegen/models/operation.py index f996915dbeb..a21436424de 100644 --- a/autorest/codegen/models/operation.py +++ b/autorest/codegen/models/operation.py @@ -15,6 +15,7 @@ from .base_schema import BaseSchema from .object_schema import ObjectSchema from .request_builder import RequestBuilder +from .schema_request import SchemaRequest _LOGGER = logging.getLogger(__name__) @@ -30,7 +31,8 @@ def __init__( description: str, api_versions: Set[str], parameters: ParameterList, - multiple_media_type_parameters: ParameterList, + multiple_content_type_parameters: ParameterList, + schema_requests: List[SchemaRequest], summary: Optional[str] = None, responses: Optional[List[SchemaResponse]] = None, exceptions: Optional[List[SchemaResponse]] = None, @@ -44,11 +46,12 @@ def __init__( description=description, parameters=parameters, responses=responses, + schema_requests=schema_requests, summary=summary, ) - self.multiple_media_type_parameters = multiple_media_type_parameters + self.multiple_content_type_parameters = multiple_content_type_parameters self.api_versions = api_versions - self.multiple_media_type_parameters = multiple_media_type_parameters + self.multiple_content_type_parameters = multiple_content_type_parameters self.exceptions = exceptions or [] self.want_description_docstring = want_description_docstring self.want_tracing = want_tracing @@ -168,7 +171,7 @@ def _imports_shared(self, async_mode: bool) -> FileImport: # pylint: disable=unu for param in self.parameters.method: file_import.merge(param.imports()) - for param in self.multiple_media_type_parameters: + for param in self.multiple_content_type_parameters: file_import.merge(param.imports()) for response in self.responses: @@ -241,28 +244,28 @@ def imports(self, async_mode: bool) -> FileImport: ) return file_import - def convert_multiple_media_type_parameters(self) -> None: + def convert_multiple_content_type_parameters(self) -> None: type_annot = ", ".join([ param.schema.operation_type_annotation - for param in self.multiple_media_type_parameters + for param in self.multiple_content_type_parameters ]) docstring_type = " or ".join([ - param.schema.docstring_type for param in self.multiple_media_type_parameters + param.schema.docstring_type for param in self.multiple_content_type_parameters ]) try: # get an optional param with object first. These params are the top choice # bc they have more info about how to serialize the body chosen_parameter = next( - p for p in self.multiple_media_type_parameters if not p.required and isinstance(p.schema, ObjectSchema) + p for p in self.multiple_content_type_parameters if not p.required and isinstance(p.schema, ObjectSchema) ) except StopIteration: # pylint: disable=broad-except # otherwise, we get the first optional param, if that exists. If not, we just grab the first one - optional_parameters = [p for p in self.multiple_media_type_parameters if not p.required] - chosen_parameter = optional_parameters[0] if optional_parameters else self.multiple_media_type_parameters[0] + optional_parameters = [p for p in self.multiple_content_type_parameters if not p.required] + chosen_parameter = optional_parameters[0] if optional_parameters else self.multiple_content_type_parameters[0] if not chosen_parameter: raise ValueError("You are missing a parameter that has multiple media types") - chosen_parameter.multiple_media_types_type_annot = f"Union[{type_annot}]" - chosen_parameter.multiple_media_types_docstring_type = docstring_type + chosen_parameter.multiple_content_types_type_annot = f"Union[{type_annot}]" + chosen_parameter.multiple_content_types_docstring_type = docstring_type self.parameters.append(chosen_parameter) @classmethod @@ -272,18 +275,22 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "Operation": parameter_creator = get_parameter(code_model).from_yaml parameter_list_creator = get_parameter_list(code_model) - parameters, multiple_media_type_parameters = create_parameters(yaml_data, code_model, parameter_creator) + schema_requests = [SchemaRequest.from_yaml(yaml, code_model=code_model) for yaml in yaml_data["requests"]] + parameters, multiple_content_type_parameters = create_parameters(yaml_data, code_model, parameter_creator) - return cls( + operation_cls = cls( code_model=code_model, yaml_data=yaml_data, name=name, description=yaml_data["language"]["python"]["description"], api_versions=set(value_dict["version"] for value_dict in yaml_data["apiVersions"]), parameters=parameter_list_creator(code_model, parameters), - multiple_media_type_parameters=parameter_list_creator(code_model, multiple_media_type_parameters), + multiple_content_type_parameters=parameter_list_creator(code_model, multiple_content_type_parameters), + schema_requests=schema_requests, summary=yaml_data["language"]["python"].get("summary"), responses=[SchemaResponse.from_yaml(yaml) for yaml in yaml_data.get("responses", [])], # Exception with no schema means default exception, we don't store them exceptions=[SchemaResponse.from_yaml(yaml) for yaml in yaml_data.get("exceptions", []) if "schema" in yaml], ) + operation_cls.parameters.default_content_type = operation_cls.default_content_type + return operation_cls diff --git a/autorest/codegen/models/paging_operation.py b/autorest/codegen/models/paging_operation.py index ed4a55f31b2..ea0237ec92d 100644 --- a/autorest/codegen/models/paging_operation.py +++ b/autorest/codegen/models/paging_operation.py @@ -25,7 +25,7 @@ def __init__( description: str, api_versions: Set[str], parameters: ParameterList, - multiple_media_type_parameters: ParameterList, + multiple_content_type_parameters: ParameterList, summary: Optional[str] = None, responses: Optional[List[SchemaResponse]] = None, exceptions: Optional[List[SchemaResponse]] = None, @@ -41,7 +41,7 @@ def __init__( description, api_versions, parameters, - multiple_media_type_parameters, + multiple_content_type_parameters, summary, responses, exceptions, diff --git a/autorest/codegen/models/parameter.py b/autorest/codegen/models/parameter.py index f9c3506a030..860b38224f1 100644 --- a/autorest/codegen/models/parameter.py +++ b/autorest/codegen/models/parameter.py @@ -69,6 +69,7 @@ def __init__( original_parameter: Optional["Parameter"] = None, client_default_value: Optional[Any] = None, keyword_only: bool = False, + content_types: Optional[List[str]] = None, ) -> None: super().__init__(yaml_data) self.code_model = code_model @@ -88,12 +89,13 @@ def __init__( self.grouped_by = grouped_by self.original_parameter = original_parameter self.client_default_value = client_default_value - self.has_multiple_media_types: bool = False - self.multiple_media_types_type_annot: Optional[str] = None - self.multiple_media_types_docstring_type: Optional[str] = None + self.has_multiple_content_types: bool = False + self.multiple_content_types_type_annot: Optional[str] = None + self.multiple_content_types_docstring_type: Optional[str] = None self._keyword_only = keyword_only self.is_multipart = yaml_data.get("language", {}).get("python", {}).get("multipart", False) self.is_data_input = yaml_data.get("isPartialBody", False) and not self.is_multipart + self.content_types = content_types def __hash__(self) -> int: return hash(self.serialized_name) @@ -202,14 +204,14 @@ def implementation(self) -> str: return self._implementation def _default_value(self) -> Tuple[Optional[Any], str, str]: - type_annot = self.multiple_media_types_type_annot or self.schema.operation_type_annotation + type_annot = self.multiple_content_types_type_annot or self.schema.operation_type_annotation if not self.required and not type_annot == "Any": type_annot = f"Optional[{type_annot}]" if self.client_default_value is not None: return self.client_default_value, self.schema.get_declaration(self.client_default_value), type_annot - if self.multiple_media_types_type_annot: + if self.multiple_content_types_type_annot: # means this parameter has multiple media types. We force default value to be None. default_value = None default_value_declaration = "None" @@ -256,7 +258,7 @@ def serialization_type(self) -> str: @property def docstring_type(self) -> str: - return self.multiple_media_types_docstring_type or self.schema.docstring_type + return self.multiple_content_types_docstring_type or self.schema.docstring_type @property def has_default_value(self): @@ -299,7 +301,13 @@ def is_positional(self) -> bool: return self.in_method_signature and not (self.is_keyword_only or self.is_kwarg) @classmethod - def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "Parameter": + def from_yaml( + cls, + yaml_data: Dict[str, Any], + *, + code_model, + content_types: Optional[List[str]] = None + ) -> "Parameter": http_protocol = yaml_data["protocol"].get("http", {"in": ParameterLocation.Other}) return cls( code_model=code_model, @@ -323,13 +331,14 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "Parameter": original_parameter=yaml_data.get("originalParameter", None), flattened=yaml_data.get("flattened", False), client_default_value=yaml_data.get("clientDefaultValue"), + content_types=content_types ) def imports(self) -> FileImport: file_import = self.schema.imports() if not self.required: file_import.add_from_import("typing", "Optional", ImportType.STDLIB, TypingSection.CONDITIONAL) - if self.has_multiple_media_types: + if self.has_multiple_content_types: file_import.add_from_import("typing", "Union", ImportType.STDLIB, TypingSection.CONDITIONAL) return file_import diff --git a/autorest/codegen/models/parameter_list.py b/autorest/codegen/models/parameter_list.py index 8a13938023c..5c0ddb39a54 100644 --- a/autorest/codegen/models/parameter_list.py +++ b/autorest/codegen/models/parameter_list.py @@ -27,12 +27,14 @@ def _method_signature_helper(positional: List[str], keyword_only: Optional[List[ class ParameterList(MutableSequence): # pylint: disable=too-many-public-methods def __init__( - self, code_model, parameters: Optional[List[Parameter]] = None + self, + code_model, + parameters: Optional[List[Parameter]] = None, ) -> None: self.code_model = code_model self.parameters = parameters or [] self._json_body: Optional[BaseSchema] = None - self._content_types: Optional[List[str]] = None + self.default_content_type: str = "" # MutableSequence @@ -150,46 +152,6 @@ def multipart(self) -> List[Parameter]: def data_inputs(self) -> List[Parameter]: return self.get_from_predicate(lambda parameter: parameter.is_data_input) - @property - def content_types(self) -> List[str]: - if self._content_types is not None: - return self._content_types - content_type_params = self.get_from_predicate( - lambda parameter: parameter.serialized_name == "content_type" - ) - content_types: OrderedSet[str] = {} - for param in content_type_params: - if isinstance(param.schema, dict): - if param.schema.get("value"): - content_types[param.schema["value"]["value"]] = None - if param.schema.get("choices"): - for choice in param.schema['choices']: - content_types[choice['value']] = None - elif isinstance(param.schema, ConstantSchema) and param.schema.value: - content_types[param.schema.value] = None - elif isinstance(param.schema, EnumSchema): - # enums - content_types.update({v.value: None for v in param.schema.values}) - if param.client_default_value: - content_types.update({param.client_default_value: None}) - self._content_types = [k for k in content_types if k is not None] - return self._content_types - - @property - def default_content_type(self) -> str: - json_content_types = [c for c in self.content_types if "json" in c] - if json_content_types: - if "application/json" in json_content_types: - return "application/json" - return json_content_types[0] - - xml_content_types = [c for c in self.content_types if "xml" in c] - if xml_content_types: - if "application/xml" in xml_content_types: - return "application/xml" - return xml_content_types[0] - return self.content_types[0] - def _filter_out_multiple_content_type(self, kwarg_params): """We don't want multiple content type kwargs in the method signature""" content_type_params = [k for k in kwarg_params if k.rest_api_name == "Content-Type"] diff --git a/autorest/codegen/models/request_builder.py b/autorest/codegen/models/request_builder.py index 186e8ae7e36..66826dd78f7 100644 --- a/autorest/codegen/models/request_builder.py +++ b/autorest/codegen/models/request_builder.py @@ -38,12 +38,12 @@ def __init__( description=description, parameters=parameters, responses=responses, + schema_requests=schema_requests, summary=summary, ) self.url = url self.method = method self.multipart = multipart - self.schema_requests = schema_requests @property def is_stream(self) -> bool: @@ -99,12 +99,12 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "RequestBuilder" first_request = yaml_data["requests"][0] - parameters, multiple_media_type_parameters = ( + parameters, multiple_content_type_parameters = ( create_parameters(yaml_data, code_model, RequestBuilderParameter.from_yaml) ) - parameter_list = RequestBuilderParameterList(code_model, parameters + multiple_media_type_parameters) schema_requests = [SchemaRequest.from_yaml(yaml, code_model=code_model) for yaml in yaml_data["requests"]] + parameter_list = RequestBuilderParameterList(code_model, parameters + multiple_content_type_parameters) parameter_list.add_body_kwargs(schema_requests) request_builder_class = cls( @@ -121,4 +121,5 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "RequestBuilder" summary=yaml_data["language"]["python"].get("summary"), ) code_model.request_builder_ids[id(yaml_data)] = request_builder_class + request_builder_class.parameters.default_content_type = request_builder_class.default_content_type return request_builder_class diff --git a/autorest/codegen/models/request_builder_parameter.py b/autorest/codegen/models/request_builder_parameter.py index 49ff3ee16b0..38981a65794 100644 --- a/autorest/codegen/models/request_builder_parameter.py +++ b/autorest/codegen/models/request_builder_parameter.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from typing import Any, Dict, Optional +from typing import Any, Dict, List, Optional from .parameter import ParameterOnlyPathAndBodyPositional, ParameterLocation, ParameterStyle def _make_public(name): @@ -68,7 +68,9 @@ def full_serialized_name(self) -> str: return self.serialized_name @classmethod - def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "RequestBuilderParameter": + def from_yaml( + cls, yaml_data: Dict[str, Any], *, code_model, content_types: Optional[List[str]] = None + ) -> "RequestBuilderParameter": http_protocol = yaml_data["protocol"].get("http", {"in": ParameterLocation.Other}) name = yaml_data["language"]["python"]["name"] location = ParameterLocation(http_protocol["in"]) @@ -94,4 +96,5 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "RequestBuilderP original_parameter=yaml_data.get("originalParameter", None), flattened=yaml_data.get("flattened", False), client_default_value=yaml_data.get("clientDefaultValue"), + content_types=content_types, ) diff --git a/autorest/codegen/models/request_builder_parameter_list.py b/autorest/codegen/models/request_builder_parameter_list.py index 13d5acbea59..51da22f0264 100644 --- a/autorest/codegen/models/request_builder_parameter_list.py +++ b/autorest/codegen/models/request_builder_parameter_list.py @@ -30,7 +30,7 @@ def _is_json(schema_requests: List[SchemaRequest], body_method_param: Parameter) content_types = set( m for request in schema_requests - for m in request.media_types + for m in request.content_types ) return any(c for c in content_types if re.compile(r'^(application|text)/([0-9a-z+.]+\+)?json$').match(c)) diff --git a/autorest/codegen/models/schema_request.py b/autorest/codegen/models/schema_request.py index b41f015db96..ae8291aaf79 100644 --- a/autorest/codegen/models/schema_request.py +++ b/autorest/codegen/models/schema_request.py @@ -13,19 +13,19 @@ class SchemaRequest(BaseModel): def __init__( self, yaml_data: Dict[str, Any], - media_types: List[str], + content_types: List[str], parameters: ParameterList, ) -> None: super().__init__(yaml_data) - self.media_types = media_types + self.content_types = content_types self.parameters = parameters @property - def pre_semicolon_media_types(self) -> List[str]: + def pre_semicolon_content_types(self) -> List[str]: """Splits on semicolon of media types and returns the first half. I.e. ["text/plain; encoding=UTF-8"] -> ["text/plain"] """ - return [media_type.split(";")[0] for media_type in self.media_types] + return [content_type.split(";")[0] for content_type in self.content_types] @property def body_parameter_has_schema(self) -> bool: @@ -50,9 +50,9 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "SchemaRequest": return cls( yaml_data=yaml_data, - media_types=yaml_data["protocol"]["http"].get("mediaTypes", []), + content_types=yaml_data["protocol"]["http"].get("mediaTypes", []), parameters=ParameterList(code_model, parameters) ) def __repr__(self) -> str: - return f"<{self.__class__.__name__} {self.media_types}>" + return f"<{self.__class__.__name__} {self.medicontent_typesa_types}>" diff --git a/autorest/codegen/models/schema_response.py b/autorest/codegen/models/schema_response.py index a87a55d207b..bbe1d4ad9e3 100644 --- a/autorest/codegen/models/schema_response.py +++ b/autorest/codegen/models/schema_response.py @@ -26,14 +26,14 @@ def __init__( self, yaml_data: Dict[str, Any], schema: Optional[BaseSchema], - media_types: List[str], + content_types: List[str], status_codes: List[Union[str, int]], headers: List[HeaderResponse], binary: bool, ) -> None: super().__init__(yaml_data) self.schema = schema - self.media_types = media_types + self.content_types = content_types self.status_codes = status_codes self.headers = headers self.binary = binary @@ -94,7 +94,7 @@ def is_exception(self) -> bool: @property def is_xml(self) -> bool: - return any(["xml" in ct for ct in self.media_types]) + return any(["xml" in ct for ct in self.content_types]) def imports(self, code_model) -> FileImport: file_import = FileImport() @@ -108,7 +108,7 @@ def from_yaml(cls, yaml_data: Dict[str, Any]) -> "SchemaResponse": return cls( yaml_data=yaml_data, schema=yaml_data.get("schema", None), # FIXME replace by operation model - media_types=yaml_data["protocol"]["http"].get("mediaTypes", []), + content_types=yaml_data["protocol"]["http"].get("mediaTypes", []), status_codes=[ int(code) if code != "default" else "default" for code in yaml_data["protocol"]["http"]["statusCodes"] ], diff --git a/autorest/codegen/serializers/builder_serializer.py b/autorest/codegen/serializers/builder_serializer.py index 24ac32e2537..51b71aa2327 100644 --- a/autorest/codegen/serializers/builder_serializer.py +++ b/autorest/codegen/serializers/builder_serializer.py @@ -92,7 +92,7 @@ def _content_type_error_check(builder: BuilderType) -> List[str]: retval = ["else:"] retval.append(" raise ValueError(") retval.append(" \"The content_type '{}' is not one of the allowed values: \"") - retval.append(f' "{builder.parameters.content_types}".format(content_type)') + retval.append(f' "{builder.content_types}".format(content_type)') retval.append(" )") return retval @@ -151,8 +151,8 @@ def _serialize_flattened_body(builder: BuilderType) -> List[str]: def _content_type_docstring(builder: BuilderType) -> str: content_type_str = ( ":keyword str content_type: Media type of the body sent to the API. " + - f'Default value is "{builder.parameters.default_content_type}". ' + - 'Allowed values are: "{}."'.format('", "'.join(builder.parameters.content_types)) + f'Default value is "{builder.default_content_type}". ' + + 'Allowed values are: "{}."'.format('", "'.join(builder.content_types)) ) return content_type_str @@ -704,7 +704,7 @@ def _serialize_body_call( def _serialize_body(self, builder: BuilderType) -> List[str]: retval = [] - send_xml = bool(builder.parameters.has_body and any(["xml" in ct for ct in builder.parameters.content_types])) + send_xml = bool(builder.parameters.has_body and any(["xml" in ct for ct in builder.content_types])) ser_ctxt_name = "serialization_ctxt" ser_ctxt = builder.parameters.body[0].xml_serialization_ctxt if send_xml else None if ser_ctxt: @@ -745,7 +745,7 @@ def _serialize_body_parameters( for idx, schema_request in enumerate(builder.request_builder.schema_requests): if_statement = "if" if idx == 0 else "elif" retval.append( - f'{if_statement} content_type.split(";")[0] in {schema_request.pre_semicolon_media_types}:' + f'{if_statement} content_type.split(";")[0] in {schema_request.pre_semicolon_content_types}:' ) retval.extend([" " + line for line in self._set_body_content_kwarg(builder, schema_request)]) retval.extend(_content_type_error_check(builder)) @@ -842,7 +842,7 @@ def response_headers_and_deserialization( if self.code_model.options["models_mode"]: retval.append(f"deserialized = self._deserialize('{response.serialization_type}', pipeline_response)") else: - is_xml = any(["xml" in ct for ct in response.media_types]) + is_xml = any(["xml" in ct for ct in response.content_types]) deserialized_value = "" deserialized_value = "ET.fromstring(response.text())" if is_xml else "response.json()" retval.append(f"if response.content:") diff --git a/test/unittests/test_optional_return_type.py b/test/unittests/test_optional_return_type.py index 49a80620908..418546ff686 100644 --- a/test/unittests/test_optional_return_type.py +++ b/test/unittests/test_optional_return_type.py @@ -6,7 +6,7 @@ import pytest from autorest.codegen.models import ( - Operation, LROOperation, PagingOperation, SchemaResponse, ParameterList, CodeModel + Operation, LROOperation, PagingOperation, SchemaResponse, ParameterList, CodeModel, SchemaRequest ) @pytest.fixture @@ -27,7 +27,8 @@ def operation(code_model): description="Operation to test optional return types", api_versions=set(["2020-05-01"]), parameters=ParameterList(code_model), - multiple_media_type_parameters=ParameterList(code_model), + multiple_content_type_parameters=ParameterList(code_model), + schema_requests=[SchemaRequest({}, ["application/json"], ParameterList(code_model))] ) @pytest.fixture @@ -39,7 +40,7 @@ def lro_operation(code_model): description="LRO Operation to test optional return types", api_versions=set(["2020-05-01"]), parameters=ParameterList(code_model), - multiple_media_type_parameters=ParameterList(code_model), + multiple_content_type_parameters=ParameterList(code_model), ) @pytest.fixture @@ -51,19 +52,19 @@ def paging_operation(code_model): description="Paging Operation to test optional return types", api_versions=set(["2020-05-01"]), parameters=ParameterList(code_model), - multiple_media_type_parameters=ParameterList(code_model), + multiple_content_type_parameters=ParameterList(code_model), ) def test_success_with_body_and_fail_no_body(operation): operation.responses = [ SchemaResponse( - yaml_data={}, media_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[200] + yaml_data={}, content_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[200] ), SchemaResponse( - yaml_data={}, media_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[202] + yaml_data={}, content_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[202] ), SchemaResponse( - yaml_data={}, media_types=["application/json", "text/json"], headers=[], binary=False, schema=None, status_codes=["default"] + yaml_data={}, content_types=["application/json", "text/json"], headers=[], binary=False, schema=None, status_codes=["default"] ) ] @@ -72,10 +73,10 @@ def test_success_with_body_and_fail_no_body(operation): def test_success_no_body_fail_with_body(operation): operation.responses = [ SchemaResponse( - yaml_data={}, media_types=["application/xml", "text/json"], headers=[], binary=False, schema=None, status_codes=[200] + yaml_data={}, content_types=["application/xml", "text/json"], headers=[], binary=False, schema=None, status_codes=[200] ), SchemaResponse( - yaml_data={}, media_types=["application/json", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=["default"] + yaml_data={}, content_types=["application/json", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=["default"] ) ] @@ -84,13 +85,13 @@ def test_success_no_body_fail_with_body(operation): def test_optional_return_type_operation(operation): operation.responses = [ SchemaResponse( - yaml_data={}, media_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[200] + yaml_data={}, content_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[200] ), SchemaResponse( - yaml_data={}, media_types=["application/json", "text/json"], headers=[], binary=False, schema=None, status_codes=[202] + yaml_data={}, content_types=["application/json", "text/json"], headers=[], binary=False, schema=None, status_codes=[202] ), SchemaResponse( - yaml_data={}, media_types=["application/json", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=["default"] + yaml_data={}, content_types=["application/json", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=["default"] ) ] @@ -99,13 +100,13 @@ def test_optional_return_type_operation(operation): def test_lro_operation(lro_operation): lro_operation.responses = [ SchemaResponse( - yaml_data={}, media_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[200] + yaml_data={}, content_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[200] ), SchemaResponse( - yaml_data={}, media_types=["application/json", "text/json"], headers=[], binary=False, schema=None, status_codes=[202] + yaml_data={}, content_types=["application/json", "text/json"], headers=[], binary=False, schema=None, status_codes=[202] ), SchemaResponse( - yaml_data={}, media_types=["application/json", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=["default"] + yaml_data={}, content_types=["application/json", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=["default"] ) ] @@ -114,13 +115,13 @@ def test_lro_operation(lro_operation): def test_paging_operation(paging_operation): paging_operation.responses = [ SchemaResponse( - yaml_data={}, media_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[200] + yaml_data={}, content_types=["application/xml", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=[200] ), SchemaResponse( - yaml_data={}, media_types=["application/json", "text/json"], headers=[], binary=False, schema=None, status_codes=[202] + yaml_data={}, content_types=["application/json", "text/json"], headers=[], binary=False, schema=None, status_codes=[202] ), SchemaResponse( - yaml_data={}, media_types=["application/json", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=["default"] + yaml_data={}, content_types=["application/json", "text/json"], headers=[], binary=False, schema={"a": "b"}, status_codes=["default"] ) ] From 00546171aae4749028753190ab5b26ca1751b71a Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 28 Oct 2021 15:05:24 -0700 Subject: [PATCH 04/23] move content types to parameters, assign cts to body params --- autorest/codegen/models/__init__.py | 3 +- autorest/codegen/models/base_builder.py | 34 +-- autorest/codegen/models/lro_operation.py | 4 + autorest/codegen/models/operation.py | 44 ++-- autorest/codegen/models/paging_operation.py | 3 + autorest/codegen/models/parameter.py | 12 +- autorest/codegen/models/parameter_list.py | 34 ++- autorest/codegen/models/request_builder.py | 17 +- .../models/request_builder_parameter_list.py | 78 ++++-- autorest/codegen/models/schema_request.py | 15 +- .../codegen/serializers/builder_serializer.py | 80 ++++-- .../_operation_group_two_operations.py | 6 +- .../_operation_group_two_operations.py | 6 +- .../llcpackagelowlevel/_llc_client.py | 4 +- .../llcpackagelowlevel/aio/_llc_client.py | 4 +- .../rest/params/__init__.py | 3 + .../rest/params/_request_builders.py | 71 ++++-- .../rest/params/_request_builders_py3.py | 61 ++++- .../llcpackagelowlevel/_llc_client.py | 4 +- .../llcpackagelowlevel/aio/_llc_client.py | 4 +- .../rest/params/__init__.py | 9 + .../rest/params/_request_builders.py | 133 ++++++++-- .../rest/params/_request_builders_py3.py | 109 +++++++-- .../aio/operations/_operations.py | 71 +++++- .../operations/_operations.py | 110 +++++++-- .../aio/operations/_operations.py | 153 ++++++++++-- .../operations/_operations.py | 230 ++++++++++++++++-- .../_operation_group_two_operations.py | 6 +- .../_operation_group_two_operations.py | 6 +- .../_operation_group_two_operations.py | 6 +- .../_operation_group_two_operations.py | 6 +- .../_operation_group_two_operations.py | 6 +- .../_operation_group_two_operations.py | 6 +- .../_operation_group_two_operations.py | 6 +- .../_operation_group_two_operations.py | 6 +- .../_operation_group_two_operations.py | 6 +- .../aio/operations/_upload_operations.py | 4 +- .../operations/_upload_operations.py | 4 +- .../_media_types_client_operations.py | 80 +++++- .../_media_types_client_operations.py | 108 +++++++- .../_binarywithcontent_typeapplicationjson.py | 2 +- .../_binarywithcontent_typeapplicationjson.py | 2 +- .../rest/upload/_request_builders.py | 9 + .../rest/upload/_request_builders_py3.py | 13 +- .../mediatypeslowlevel/rest/__init__.py | 3 + .../rest/_request_builders.py | 59 ++++- .../rest/_request_builders_py3.py | 51 +++- .../AcceptanceTests/asynctests/test_binary.py | 2 +- .../aio/operations/_operations.py | 4 +- .../operations/_operations.py | 4 +- .../aio/operations/_operations.py | 81 +++++- .../operations/_operations.py | 109 ++++++++- 52 files changed, 1513 insertions(+), 378 deletions(-) diff --git a/autorest/codegen/models/__init__.py b/autorest/codegen/models/__init__.py index 223ebb3a4de..89c12fe0bd2 100644 --- a/autorest/codegen/models/__init__.py +++ b/autorest/codegen/models/__init__.py @@ -10,7 +10,7 @@ from .object_schema import ObjectSchema, get_object_schema, HiddenModelObjectSchema from .dictionary_schema import DictionarySchema from .list_schema import ListSchema -from .primitive_schemas import get_primitive_schema, AnySchema, PrimitiveSchema +from .primitive_schemas import get_primitive_schema, AnySchema, PrimitiveSchema, IOSchema from .enum_schema import EnumSchema, HiddenModelEnumSchema, get_enum_schema from .base_schema import BaseSchema from .constant_schema import ConstantSchema @@ -62,6 +62,7 @@ "RequestBuilderParameter", "HiddenModelObjectSchema", "ParameterStyle", + "IOSchema", ] def _generate_as_object_schema(yaml_data: Dict[str, Any]) -> bool: diff --git a/autorest/codegen/models/base_builder.py b/autorest/codegen/models/base_builder.py index 068cabf47fd..b6e2a9d0f6f 100644 --- a/autorest/codegen/models/base_builder.py +++ b/autorest/codegen/models/base_builder.py @@ -14,11 +14,16 @@ _M4_HEADER_PARAMETERS = ["content_type", "accept"] -def create_parameters(yaml_data: Dict[str, Any], code_model, parameter_creator: Callable): +def create_parameters( + yaml_data: Dict[str, Any], code_model, parameter_creator: Callable +): multiple_requests = len(yaml_data["requests"]) > 1 multiple_content_type_parameters = [] - parameters = [parameter_creator(yaml, code_model=code_model) for yaml in yaml_data.get("parameters", [])] + parameters = [ + parameter_creator(yaml, code_model=code_model) + for yaml in yaml_data.get("parameters", []) + ] for request in yaml_data["requests"]: for yaml in request.get("parameters", []): @@ -79,24 +84,9 @@ def __init__( self.summary = summary self.schema_requests = schema_requests - @property - def default_content_type(self) -> str: - json_content_types = [c for c in self.content_types if "json" in c] - if json_content_types: - if "application/json" in json_content_types: - return "application/json" - return json_content_types[0] - - xml_content_types = [c for c in self.content_types if "xml" in c] - if xml_content_types: - if "application/xml" in xml_content_types: - return "application/xml" - return xml_content_types[0] - return self.content_types[0] - @property def default_content_type_declaration(self) -> str: - return f'"{self.default_content_type}"' + return f'"{self.parameters.default_content_type}"' def get_response_from_status(self, status_code: Optional[Union[str, int]]) -> SchemaResponse: for response in self.responses: @@ -108,11 +98,3 @@ def get_response_from_status(self, status_code: Optional[Union[str, int]]) -> Sc def success_status_code(self) -> List[Union[str, int]]: """The list of all successfull status code.""" return [code for response in self.responses for code in response.status_codes if code != "default"] - - @property - def content_types(self) -> List[str]: - return list(set( - m - for request in self.schema_requests - for m in request.content_types - )) diff --git a/autorest/codegen/models/lro_operation.py b/autorest/codegen/models/lro_operation.py index 6fba4d7050c..1c2a1b6dae4 100644 --- a/autorest/codegen/models/lro_operation.py +++ b/autorest/codegen/models/lro_operation.py @@ -11,6 +11,7 @@ from .schema_response import SchemaResponse from .imports import ImportType, TypingSection from .base_schema import BaseSchema +from .schema_request import SchemaRequest _LOGGER = logging.getLogger(__name__) @@ -25,6 +26,7 @@ def __init__( api_versions: Set[str], parameters: ParameterList, multiple_content_type_parameters: ParameterList, + schema_requests: List[SchemaRequest], summary: Optional[str] = None, responses: Optional[List[SchemaResponse]] = None, exceptions: Optional[List[SchemaResponse]] = None, @@ -39,6 +41,7 @@ def __init__( api_versions, parameters, multiple_content_type_parameters, + schema_requests, summary, responses, exceptions, @@ -86,6 +89,7 @@ def initial_operation(self) -> Operation: description="", api_versions=self.api_versions, parameters=self.parameters, + schema_requests=self.schema_requests, multiple_content_type_parameters=self.multiple_content_type_parameters, summary=self.summary, responses=self.responses, diff --git a/autorest/codegen/models/operation.py b/autorest/codegen/models/operation.py index a21436424de..a7349b95491 100644 --- a/autorest/codegen/models/operation.py +++ b/autorest/codegen/models/operation.py @@ -82,28 +82,7 @@ def is_stream_response(self) -> bool: @property def body_kwargs_to_pass_to_request_builder(self) -> List[str]: - kwargs = [] - if not self.parameters.has_body: - return [] - body_kwarg_names = self.request_builder.parameters.body_kwarg_names - for kwarg in body_kwarg_names: - if kwarg == "content": - if self.request_builder.is_stream: - kwargs.append("content") - else: - kwargs.append(kwarg) - if not kwargs and not self.parameters.body[0].constant: - kwargs.append("content") - return kwargs - - @property - def serialized_body_kwarg(self) -> str: - # body serialization can be passed to either "json" or "content" - if "json" in self.body_kwargs_to_pass_to_request_builder: - return "json" - if not self.request_builder.is_stream: - return "content" - raise ValueError("You should not be trying to serialize this body") + return [p.serialized_name for p in self.request_builder.body_kwargs_to_get] @property def has_optional_return_type(self) -> bool: @@ -256,12 +235,15 @@ def convert_multiple_content_type_parameters(self) -> None: # get an optional param with object first. These params are the top choice # bc they have more info about how to serialize the body chosen_parameter = next( - p for p in self.multiple_content_type_parameters if not p.required and isinstance(p.schema, ObjectSchema) + p for p in self.multiple_content_type_parameters + if not p.required and isinstance(p.schema, ObjectSchema) ) except StopIteration: # pylint: disable=broad-except # otherwise, we get the first optional param, if that exists. If not, we just grab the first one optional_parameters = [p for p in self.multiple_content_type_parameters if not p.required] - chosen_parameter = optional_parameters[0] if optional_parameters else self.multiple_content_type_parameters[0] + chosen_parameter = ( + optional_parameters[0] if optional_parameters else self.multiple_content_type_parameters[0] + ) if not chosen_parameter: raise ValueError("You are missing a parameter that has multiple media types") chosen_parameter.multiple_content_types_type_annot = f"Union[{type_annot}]" @@ -276,21 +258,23 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "Operation": parameter_creator = get_parameter(code_model).from_yaml parameter_list_creator = get_parameter_list(code_model) schema_requests = [SchemaRequest.from_yaml(yaml, code_model=code_model) for yaml in yaml_data["requests"]] - parameters, multiple_content_type_parameters = create_parameters(yaml_data, code_model, parameter_creator) + parameters, multiple_content_type_parameters = create_parameters( + yaml_data, code_model, parameter_creator + ) - operation_cls = cls( + return cls( code_model=code_model, yaml_data=yaml_data, name=name, description=yaml_data["language"]["python"]["description"], api_versions=set(value_dict["version"] for value_dict in yaml_data["apiVersions"]), - parameters=parameter_list_creator(code_model, parameters), - multiple_content_type_parameters=parameter_list_creator(code_model, multiple_content_type_parameters), + parameters=parameter_list_creator(code_model, parameters, schema_requests), + multiple_content_type_parameters=parameter_list_creator( + code_model, multiple_content_type_parameters, schema_requests + ), schema_requests=schema_requests, summary=yaml_data["language"]["python"].get("summary"), responses=[SchemaResponse.from_yaml(yaml) for yaml in yaml_data.get("responses", [])], # Exception with no schema means default exception, we don't store them exceptions=[SchemaResponse.from_yaml(yaml) for yaml in yaml_data.get("exceptions", []) if "schema" in yaml], ) - operation_cls.parameters.default_content_type = operation_cls.default_content_type - return operation_cls diff --git a/autorest/codegen/models/paging_operation.py b/autorest/codegen/models/paging_operation.py index ea0237ec92d..39822fd3b5a 100644 --- a/autorest/codegen/models/paging_operation.py +++ b/autorest/codegen/models/paging_operation.py @@ -11,6 +11,7 @@ from .request_builder import RequestBuilder from .imports import ImportType, FileImport, TypingSection from .object_schema import ObjectSchema +from .schema_request import SchemaRequest from .parameter_list import ParameterList _LOGGER = logging.getLogger(__name__) @@ -26,6 +27,7 @@ def __init__( api_versions: Set[str], parameters: ParameterList, multiple_content_type_parameters: ParameterList, + schema_requests: List[SchemaRequest], summary: Optional[str] = None, responses: Optional[List[SchemaResponse]] = None, exceptions: Optional[List[SchemaResponse]] = None, @@ -42,6 +44,7 @@ def __init__( api_versions, parameters, multiple_content_type_parameters, + schema_requests, summary, responses, exceptions, diff --git a/autorest/codegen/models/parameter.py b/autorest/codegen/models/parameter.py index 860b38224f1..4ff43cc996c 100644 --- a/autorest/codegen/models/parameter.py +++ b/autorest/codegen/models/parameter.py @@ -14,7 +14,6 @@ from .constant_schema import ConstantSchema from .object_schema import ObjectSchema from .property import Property -from .primitive_schemas import IOSchema _LOGGER = logging.getLogger(__name__) @@ -95,7 +94,7 @@ def __init__( self._keyword_only = keyword_only self.is_multipart = yaml_data.get("language", {}).get("python", {}).get("multipart", False) self.is_data_input = yaml_data.get("isPartialBody", False) and not self.is_multipart - self.content_types = content_types + self.content_types = content_types or [] def __hash__(self) -> int: return hash(self.serialized_name) @@ -123,8 +122,6 @@ def description(self, val: str): def is_json_parameter(self) -> bool: if self.is_multipart or self.is_data_input: return False - if isinstance(self.schema, IOSchema): - return False if self.style == ParameterStyle.xml: return False return True @@ -165,6 +162,13 @@ def xml_serialization_ctxt(self) -> str: def is_body(self) -> bool: return self.location == ParameterLocation.Body + @property + def pre_semicolon_content_types(self) -> List[str]: + """Splits on semicolon of media types and returns the first half. + I.e. ["text/plain; encoding=UTF-8"] -> ["text/plain"] + """ + return [content_type.split(";")[0] for content_type in self.content_types] + @property def in_method_signature(self) -> bool: return not( diff --git a/autorest/codegen/models/parameter_list.py b/autorest/codegen/models/parameter_list.py index 5c0ddb39a54..2cdc1475d2c 100644 --- a/autorest/codegen/models/parameter_list.py +++ b/autorest/codegen/models/parameter_list.py @@ -6,15 +6,16 @@ from collections.abc import MutableSequence from copy import copy import logging -from typing import cast, List, Callable, Optional, TypeVar, Dict +from typing import cast, List, Callable, Optional, TypeVar, Dict, TYPE_CHECKING from .parameter import Parameter, ParameterLocation -from .constant_schema import ConstantSchema from .base_schema import BaseSchema -from .enum_schema import EnumSchema from .dictionary_schema import DictionarySchema from .primitive_schemas import AnySchema, StringSchema +if TYPE_CHECKING: + from .schema_request import SchemaRequest + T = TypeVar('T') OrderedSet = Dict[T, None] @@ -30,11 +31,12 @@ def __init__( self, code_model, parameters: Optional[List[Parameter]] = None, + schema_requests: Optional[List["SchemaRequest"]] = None, ) -> None: self.code_model = code_model + self.schema_requests = schema_requests or [] self.parameters = parameters or [] self._json_body: Optional[BaseSchema] = None - self.default_content_type: str = "" # MutableSequence @@ -66,6 +68,30 @@ def get_from_predicate(self, predicate: Callable[[Parameter], bool]) -> List[Par def get_from_location(self, location: ParameterLocation) -> List[Parameter]: return self.get_from_predicate(lambda parameter: parameter.location == location) + @property + def content_types(self) -> List[str]: + ordered_set = { + m: None + for request in self.schema_requests + for m in request.content_types + } + return list(ordered_set.keys()) + + @property + def default_content_type(self) -> str: + json_content_types = [c for c in self.content_types if "json" in c] + if json_content_types: + if "application/json" in json_content_types: + return "application/json" + return json_content_types[0] + + xml_content_types = [c for c in self.content_types if "xml" in c] + if xml_content_types: + if "application/xml" in xml_content_types: + return "application/xml" + return xml_content_types[0] + return self.content_types[0] + @property def json_body(self) -> BaseSchema: if not self._json_body: diff --git a/autorest/codegen/models/request_builder.py b/autorest/codegen/models/request_builder.py index 66826dd78f7..a25f8e178d1 100644 --- a/autorest/codegen/models/request_builder.py +++ b/autorest/codegen/models/request_builder.py @@ -11,6 +11,7 @@ from .schema_request import SchemaRequest from .schema_response import SchemaResponse from .imports import FileImport, ImportType, TypingSection +from .parameter import Parameter T = TypeVar('T') @@ -50,6 +51,10 @@ def is_stream(self) -> bool: """Is the request we're preparing a stream, like an upload.""" return any(request.is_stream_request for request in self.schema_requests) + @property + def body_kwargs_to_get(self) -> List[Parameter]: + return self.parameters.body_kwargs_to_get + @property def operation_group_name(self) -> str: return self.yaml_data["language"]["python"]["operationGroupName"] @@ -98,15 +103,13 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "RequestBuilder" name = "_".join([n for n in names if n]) first_request = yaml_data["requests"][0] - + schema_requests = [SchemaRequest.from_yaml(yaml, code_model=code_model) for yaml in yaml_data["requests"]] parameters, multiple_content_type_parameters = ( create_parameters(yaml_data, code_model, RequestBuilderParameter.from_yaml) ) - - schema_requests = [SchemaRequest.from_yaml(yaml, code_model=code_model) for yaml in yaml_data["requests"]] - parameter_list = RequestBuilderParameterList(code_model, parameters + multiple_content_type_parameters) - parameter_list.add_body_kwargs(schema_requests) - + parameter_list = RequestBuilderParameterList( + code_model, parameters + multiple_content_type_parameters, schema_requests + ) request_builder_class = cls( code_model=code_model, yaml_data=yaml_data, @@ -121,5 +124,5 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "RequestBuilder" summary=yaml_data["language"]["python"].get("summary"), ) code_model.request_builder_ids[id(yaml_data)] = request_builder_class - request_builder_class.parameters.default_content_type = request_builder_class.default_content_type + parameter_list.add_body_kwargs() return request_builder_class diff --git a/autorest/codegen/models/request_builder_parameter_list.py b/autorest/codegen/models/request_builder_parameter_list.py index 51da22f0264..9f8c5da667e 100644 --- a/autorest/codegen/models/request_builder_parameter_list.py +++ b/autorest/codegen/models/request_builder_parameter_list.py @@ -18,29 +18,22 @@ OrderedSet = Dict[T, None] _REQUEST_BUILDER_BODY_NAMES = ["files", "json", "content", "data"] +_JSON_REGEXP = re.compile(r'^(application|text)/([0-9a-z+.]+\+)?json$') -def _is_json(schema_requests: List[SchemaRequest], body_method_param: Parameter) -> bool: - if 'json' in body_method_param.serialization_formats: - return True - if any( - sr for sr in schema_requests - if sr.yaml_data.get("protocol", {}).get('http', {}).get('knownMediaType') == "json" - ): - return True - content_types = set( - m - for request in schema_requests - for m in request.content_types - ) - return any(c for c in content_types if re.compile(r'^(application|text)/([0-9a-z+.]+\+)?json$').match(c)) - +def _update_content_types(content_types_to_assign: List[str], param: Parameter): + return [ + c for c in content_types_to_assign if c not in param.content_types + ] class RequestBuilderParameterList(ParameterList): def __init__( - self, code_model, parameters: Optional[List[RequestBuilderParameter]] = None + self, + code_model, + parameters: Optional[List[RequestBuilderParameter]] = None, + schema_requests: Optional[List[SchemaRequest]] = None, ) -> None: super(RequestBuilderParameterList, self).__init__( - code_model, parameters # type: ignore + code_model, parameters, schema_requests # type: ignore ) self.body_kwarg_names: OrderedSet[str] = {} self.parameters: List[RequestBuilderParameter] = parameters or [] # type: ignore @@ -49,7 +42,23 @@ def _change_body_param_name(self, parameter: Parameter, name: str) -> None: self.body_kwarg_names[name] = None parameter.serialized_name = name - def add_body_kwargs(self, schema_requests: List[SchemaRequest]) -> None: + def _is_json(self, body_method_param: Parameter) -> bool: + if 'json' in body_method_param.serialization_formats: + return True + if any( + sr for sr in self.schema_requests + if sr.yaml_data.get("protocol", {}).get('http', {}).get('knownMediaType') == "json" + ): + return True + return any(c for c in self.content_types if _JSON_REGEXP.match(c)) + + @property + def body_kwargs_to_get(self) -> List[Parameter]: + if not self.body_kwarg_names: + return [] + return [b for b in self.body if b.content_types] + + def add_body_kwargs(self) -> None: # pylint: disable=too-many-statements try: body_kwargs_added = [] body_method_param = next( @@ -60,6 +69,7 @@ def add_body_kwargs(self, schema_requests: List[SchemaRequest]) -> None: else: serialized_name: str = "" + content_types_to_assign = copy(self.content_types) if body_method_param.is_multipart: serialized_name = "files" file_kwarg = copy(body_method_param) @@ -74,6 +84,11 @@ def add_body_kwargs(self, schema_requests: List[SchemaRequest]) -> None: file_kwarg.description ) file_kwarg.is_multipart = False + file_kwarg.content_types = [ + c for c in content_types_to_assign + if c == "multipart/form-data" + ] + content_types_to_assign = _update_content_types(content_types_to_assign, file_kwarg) body_kwargs_added.append(file_kwarg) if body_method_param.is_data_input: serialized_name = "data" @@ -89,8 +104,21 @@ def add_body_kwargs(self, schema_requests: List[SchemaRequest]) -> None: data_kwarg.description ) data_kwarg.is_data_input = False + data_kwarg.content_types = [ + c for c in content_types_to_assign + if c == "application/x-www-form-urlencoded" + ] + content_types_to_assign = _update_content_types(content_types_to_assign, data_kwarg) body_kwargs_added.append(data_kwarg) - if _is_json(schema_requests, body_method_param): + if body_method_param.constant: + # we don't add body kwargs for constant bodies + if not serialized_name and self._is_json(body_method_param): + serialized_name = "json" + else: + serialized_name = "content" + body_method_param.serialized_name = serialized_name + return + if self._is_json(body_method_param): serialized_name = "json" json_kwarg = copy(body_method_param) self._change_body_param_name(json_kwarg, "json") @@ -100,12 +128,13 @@ def add_body_kwargs(self, schema_requests: List[SchemaRequest]) -> None: json_kwarg.description ) json_kwarg.schema = AnySchema(namespace="", yaml_data={}) + json_kwarg.content_types = [ + c for c in content_types_to_assign + if _JSON_REGEXP.match(c) + ] + content_types_to_assign = _update_content_types(content_types_to_assign, json_kwarg) body_kwargs_added.append(json_kwarg) - if body_method_param.constant: - # we don't add body kwargs for constant bodies - serialized_name = serialized_name or "content" - body_method_param.serialized_name = serialized_name - return + content_kwarg = copy(body_method_param) self._change_body_param_name(content_kwarg, "content") content_kwarg.schema = AnySchema(namespace="", yaml_data={}) @@ -116,6 +145,7 @@ def add_body_kwargs(self, schema_requests: List[SchemaRequest]) -> None: ) content_kwarg.is_data_input = False content_kwarg.is_multipart = False + content_kwarg.content_types = content_types_to_assign body_kwargs_added.append(content_kwarg) if len(body_kwargs_added) == 1: body_kwargs_added[0].required = body_method_param.required diff --git a/autorest/codegen/models/schema_request.py b/autorest/codegen/models/schema_request.py index ae8291aaf79..d9d92a4d3a0 100644 --- a/autorest/codegen/models/schema_request.py +++ b/autorest/codegen/models/schema_request.py @@ -20,19 +20,6 @@ def __init__( self.content_types = content_types self.parameters = parameters - @property - def pre_semicolon_content_types(self) -> List[str]: - """Splits on semicolon of media types and returns the first half. - I.e. ["text/plain; encoding=UTF-8"] -> ["text/plain"] - """ - return [content_type.split(";")[0] for content_type in self.content_types] - - @property - def body_parameter_has_schema(self) -> bool: - """Tell if that request has a parameter that defines a body. - """ - return any([p for p in self.parameters if hasattr(p, 'schema') and p.schema]) - @property def is_stream_request(self) -> bool: """Is the request expected to be streamable, like a download.""" @@ -55,4 +42,4 @@ def from_yaml(cls, yaml_data: Dict[str, Any], *, code_model) -> "SchemaRequest": ) def __repr__(self) -> str: - return f"<{self.__class__.__name__} {self.medicontent_typesa_types}>" + return f"<{self.__class__.__name__} {self.content_types}>" diff --git a/autorest/codegen/serializers/builder_serializer.py b/autorest/codegen/serializers/builder_serializer.py index 51b71aa2327..d974150940d 100644 --- a/autorest/codegen/serializers/builder_serializer.py +++ b/autorest/codegen/serializers/builder_serializer.py @@ -21,12 +21,13 @@ DictionarySchema, ListSchema, BaseSchema, - SchemaRequest, Parameter, RequestBuilder, RequestBuilderParameter, EnumSchema, SchemaResponse, + IOSchema, + ParameterStyle, ) from . import utils @@ -92,7 +93,7 @@ def _content_type_error_check(builder: BuilderType) -> List[str]: retval = ["else:"] retval.append(" raise ValueError(") retval.append(" \"The content_type '{}' is not one of the allowed values: \"") - retval.append(f' "{builder.content_types}".format(content_type)') + retval.append(f' "{builder.parameters.content_types}".format(content_type)') retval.append(" )") return retval @@ -151,11 +152,31 @@ def _serialize_flattened_body(builder: BuilderType) -> List[str]: def _content_type_docstring(builder: BuilderType) -> str: content_type_str = ( ":keyword str content_type: Media type of the body sent to the API. " + - f'Default value is "{builder.default_content_type}". ' + - 'Allowed values are: "{}."'.format('", "'.join(builder.content_types)) + f'Default value is "{builder.parameters.default_content_type}". ' + + 'Allowed values are: "{}."'.format('", "'.join(builder.parameters.content_types)) ) return content_type_str +def _get_body_param_from_body_kwarg(builder: BuilderType, body_kwarg: str) -> Parameter: + # determine which of the body parameters returned from m4 corresponds to this body_kwarg + if not builder.multiple_content_type_parameters.has_body: + return builder.parameters.body[0] + if body_kwarg == "data": + return next(p for p in builder.multiple_content_type_parameters if p.is_data_input) + if body_kwarg == "files": + return next(p for p in builder.multiple_content_type_parameters if p.is_multipart) + if body_kwarg == "json": + # first check if there's any non-binary. In the case of multiple content types, there's + # usually one binary (for content), and one schema parameter (for json) + try: + return next( + p for p in builder.multiple_content_type_parameters + if not isinstance(p.schema, IOSchema) + ) + except StopIteration: + return next(p for p in builder.multiple_content_type_parameters if p.is_json_parameter) + return builder.multiple_content_type_parameters[0] + class _BuilderSerializerProtocol(ABC): @property @abstractmethod @@ -690,28 +711,28 @@ def _has_data_example_template(self, builder: BuilderType) -> bool: return bool(builder.parameters.data_inputs) def _serialize_body_call( - self, builder: BuilderType, send_xml: bool, ser_ctxt: Optional[str], ser_ctxt_name: str + self, builder: BuilderType, body_param: Parameter, send_xml: bool, ser_ctxt: Optional[str], ser_ctxt_name: str ) -> str: - body_param = builder.parameters.body[0] body_is_xml = ", is_xml=True" if send_xml else "" pass_ser_ctxt = f", {ser_ctxt_name}={ser_ctxt_name}" if ser_ctxt else "" + body_kwarg_to_pass = builder.body_kwargs_to_pass_to_request_builder[0] if self.code_model.options["models_mode"]: return ( - f"{builder.serialized_body_kwarg} = self._serialize.body({body_param.serialized_name}, " + f"{body_kwarg_to_pass} = self._serialize.body({body_param.serialized_name}, " f"'{ body_param.serialization_type }'{body_is_xml}{ pass_ser_ctxt })" ) - return f"{builder.serialized_body_kwarg} = {body_param.serialized_name}" + return f"{body_kwarg_to_pass} = {body_param.serialized_name}" - def _serialize_body(self, builder: BuilderType) -> List[str]: + def _serialize_body(self, builder: BuilderType, body_param: Parameter, body_kwarg: str) -> List[str]: retval = [] - send_xml = bool(builder.parameters.has_body and any(["xml" in ct for ct in builder.content_types])) + send_xml = bool(builder.parameters.has_body and any(["xml" in ct for ct in builder.parameters.content_types])) ser_ctxt_name = "serialization_ctxt" ser_ctxt = builder.parameters.body[0].xml_serialization_ctxt if send_xml else None if ser_ctxt: retval.append(f'{ser_ctxt_name} = {{"xml": {{{ser_ctxt}}}}}') - body_param = builder.parameters.body[0] serialize_body_call = self._serialize_body_call( builder, + body_param, send_xml, ser_ctxt, ser_ctxt_name, @@ -723,15 +744,22 @@ def _serialize_body(self, builder: BuilderType) -> List[str]: retval.append(" " + serialize_body_call) if len(builder.body_kwargs_to_pass_to_request_builder) == 1: retval.append("else:") - retval.append(f" {builder.serialized_body_kwarg} = None") + retval.append(f" {body_kwarg} = None") return retval - def _set_body_content_kwarg(self, builder: BuilderType, schema_request: SchemaRequest): - retval = [] - if schema_request.is_stream_request: - retval.append(f"content = {builder.parameters.body[0].serialized_name}") - elif schema_request.body_parameter_has_schema and not builder.request_builder.multipart: - retval.extend(self._serialize_body(builder)) + def _set_body_content_kwarg( + self, builder: BuilderType, body_param: Parameter, body_kwarg: Parameter + ) -> List[str]: + retval: List[str] = [] + if body_kwarg.serialized_name == "data" or body_kwarg.serialized_name == "files": + return retval + try: + if not body_param.style == ParameterStyle.binary: + retval.extend(self._serialize_body(builder, body_param, body_kwarg.serialized_name)) + return retval + except AttributeError: + pass + retval.append(f"{body_kwarg.serialized_name} = {body_param.serialized_name}") return retval @@ -739,15 +767,21 @@ def _serialize_body_parameters( self, builder: BuilderType, ) -> List[str]: retval = [] - if len(builder.request_builder.schema_requests) == 1: - retval.extend(self._set_body_content_kwarg(builder, builder.request_builder.schema_requests[0])) + body_groups = [ + p for p in builder.request_builder.parameters.body + if p.content_types + ] + if len(body_groups) == 1: + retval.extend(self._set_body_content_kwarg(builder, builder.parameters.body[0], body_groups[0])) else: - for idx, schema_request in enumerate(builder.request_builder.schema_requests): + + for idx, body_kwarg in enumerate(body_groups): + body_param = _get_body_param_from_body_kwarg(builder, body_kwarg.serialized_name) if_statement = "if" if idx == 0 else "elif" retval.append( - f'{if_statement} content_type.split(";")[0] in {schema_request.pre_semicolon_content_types}:' + f'{if_statement} content_type.split(";")[0] in {body_kwarg.pre_semicolon_content_types}:' ) - retval.extend([" " + line for line in self._set_body_content_kwarg(builder, schema_request)]) + retval.extend([" " + line for line in self._set_body_content_kwarg(builder, body_param, body_kwarg)]) retval.extend(_content_type_error_check(builder)) return retval diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py index 6e30162b5bf..f8eea3e5cf7 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py @@ -73,11 +73,11 @@ async def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py index 6bc7c2cbf6a..76800d512fd 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py @@ -137,11 +137,11 @@ def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/_llc_client.py b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/_llc_client.py index 52a5e042583..c3b3b9a29f3 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/_llc_client.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/_llc_client.py @@ -53,8 +53,8 @@ def send_request( Use these helper methods to create the request you pass to this method. >>> from llcpackagelowlevel.rest import params - >>> request = params.build_get_required_request(parameter1=parameter1, parameter2=parameter2, parameter3=parameter3, **kwargs) - + >>> request = params.build_get_required_request(parameter=parameter, **kwargs) + >>> response = client.send_request(request) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/aio/_llc_client.py b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/aio/_llc_client.py index 322d904158d..8fad70c6dd7 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/aio/_llc_client.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/aio/_llc_client.py @@ -42,8 +42,8 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt Use these helper methods to create the request you pass to this method. >>> from llcpackagelowlevel.rest import params - >>> request = params.build_get_required_request(parameter1=parameter1, parameter2=parameter2, parameter3=parameter3, **kwargs) - + >>> request = params.build_get_required_request(parameter=parameter, **kwargs) + >>> response = await client.send_request(request) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/__init__.py index f842c47d569..bff50b1230a 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/__init__.py @@ -8,9 +8,12 @@ try: from ._request_builders_py3 import build_get_required_request + from ._request_builders_py3 import build_post_parameters_request except (SyntaxError, ImportError): from ._request_builders import build_get_required_request # type: ignore + from ._request_builders import build_post_parameters_request # type: ignore __all__ = [ "build_get_required_request", + "build_post_parameters_request", ] diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/_request_builders.py b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/_request_builders.py index b9b883dca4b..50a258b212c 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/_request_builders.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/_request_builders.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from typing import Any, Optional _SERIALIZER = Serializer() @@ -27,31 +27,23 @@ def build_get_required_request( See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. - :keyword parameter1: I am a required parameter. - :paramtype parameter1: str - :keyword parameter2: I am a required parameter. - :paramtype parameter2: str - :keyword parameter3: I am a required parameter and I'm last in Swagger. - :paramtype parameter3: str + :keyword parameter: I am a required parameter. + :paramtype parameter: str :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. :rtype: ~azure.core.rest.HttpRequest """ - parameter1 = kwargs.pop('parameter1') # type: str - parameter2 = kwargs.pop('parameter2') # type: str - parameter3 = kwargs.pop('parameter3') # type: str + parameter = kwargs.pop('parameter') # type: str accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/llc/parameters') + url = kwargs.pop("template_url", '/servicedriven/parameters') # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['parameter1'] = _SERIALIZER.query("parameter1", parameter1, 'str') - query_parameters['parameter2'] = _SERIALIZER.query("parameter2", parameter2, 'str') - query_parameters['parameter3'] = _SERIALIZER.query("parameter3", parameter3, 'str') + query_parameters['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] @@ -64,3 +56,54 @@ def build_get_required_request( headers=header_parameters, **kwargs ) + + +def build_post_parameters_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """POST a JSON. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. I am a body parameter. My only valid JSON entry is { url: + "http://example.org/myimage.jpeg" }. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). I am a body parameter. My only valid JSON entry is { url: + "http://example.org/myimage.jpeg" }. + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "url": "str" # Required. + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/servicedriven/parameters') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/_request_builders_py3.py b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/_request_builders_py3.py index d961281dba4..a3c928e7f69 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/_request_builders_py3.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCInitialLowLevel/llcpackagelowlevel/rest/params/_request_builders_py3.py @@ -5,7 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, Optional from azure.core.rest import HttpRequest from msrest import Serializer @@ -13,18 +13,14 @@ _SERIALIZER = Serializer() -def build_get_required_request(*, parameter1: str, parameter2: str, parameter3: str, **kwargs: Any) -> HttpRequest: +def build_get_required_request(*, parameter: str, **kwargs: Any) -> HttpRequest: """Get true Boolean value on path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. - :keyword parameter1: I am a required parameter. - :paramtype parameter1: str - :keyword parameter2: I am a required parameter. - :paramtype parameter2: str - :keyword parameter3: I am a required parameter and I'm last in Swagger. - :paramtype parameter3: str + :keyword parameter: I am a required parameter. + :paramtype parameter: str :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. @@ -33,16 +29,57 @@ def build_get_required_request(*, parameter1: str, parameter2: str, parameter3: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/llc/parameters") + url = kwargs.pop("template_url", "/servicedriven/parameters") # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["parameter1"] = _SERIALIZER.query("parameter1", parameter1, "str") - query_parameters["parameter2"] = _SERIALIZER.query("parameter2", parameter2, "str") - query_parameters["parameter3"] = _SERIALIZER.query("parameter3", parameter3, "str") + query_parameters["parameter"] = _SERIALIZER.query("parameter", parameter, "str") # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + + +def build_post_parameters_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: + """POST a JSON. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. I am a body parameter. My only valid JSON entry is { url: + "http://example.org/myimage.jpeg" }. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). I am a body parameter. My only valid JSON entry is { url: + "http://example.org/myimage.jpeg" }. + :paramtype content: any + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = { + "url": "str" # Required. + } + """ + + content_type = kwargs.pop("content_type", None) # type: Optional[str] + + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", "/servicedriven/parameters") + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/_llc_client.py b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/_llc_client.py index f9e1d1699dc..4c9bcbc8482 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/_llc_client.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/_llc_client.py @@ -53,8 +53,8 @@ def send_request( Use these helper methods to create the request you pass to this method. >>> from llcpackagelowlevel.rest import params - >>> request = params.build_get_required_request(parameter3=parameter3, parameter1=parameter1, parameter2=parameter2, **kwargs) - + >>> request = params.build_get_required_request(parameter=parameter, new_parameter=new_parameter, **kwargs) + >>> response = client.send_request(request) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/aio/_llc_client.py b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/aio/_llc_client.py index 6df77a23fb5..4dbe583911d 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/aio/_llc_client.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/aio/_llc_client.py @@ -42,8 +42,8 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt Use these helper methods to create the request you pass to this method. >>> from llcpackagelowlevel.rest import params - >>> request = params.build_get_required_request(parameter3=parameter3, parameter1=parameter1, parameter2=parameter2, **kwargs) - + >>> request = params.build_get_required_request(parameter=parameter, new_parameter=new_parameter, **kwargs) + >>> response = await client.send_request(request) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/__init__.py index f842c47d569..a3bf8ca28d8 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/__init__.py @@ -8,9 +8,18 @@ try: from ._request_builders_py3 import build_get_required_request + from ._request_builders_py3 import build_post_parameters_request + from ._request_builders_py3 import build_delete_parameters_request + from ._request_builders_py3 import build_get_new_operation_request except (SyntaxError, ImportError): from ._request_builders import build_get_required_request # type: ignore + from ._request_builders import build_post_parameters_request # type: ignore + from ._request_builders import build_delete_parameters_request # type: ignore + from ._request_builders import build_get_new_operation_request # type: ignore __all__ = [ "build_get_required_request", + "build_post_parameters_request", + "build_delete_parameters_request", + "build_get_new_operation_request", ] diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/_request_builders.py b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/_request_builders.py index 521702b6f29..2b762486a18 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/_request_builders.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/_request_builders.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, IO, Optional, Union _SERIALIZER = Serializer() @@ -27,32 +27,28 @@ def build_get_required_request( See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. - :keyword parameter3: I am a required parameter and I'm last in Swagger. - :paramtype parameter3: str - :keyword parameter1: I am a required parameter with a client default value. - :paramtype parameter1: str - :keyword parameter2: I was a required parameter, but now I'm optional. - :paramtype parameter2: str + :keyword parameter: I am a required parameter. + :paramtype parameter: str + :keyword new_parameter: I'm a new input optional parameter. + :paramtype new_parameter: str :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. :rtype: ~azure.core.rest.HttpRequest """ - parameter3 = kwargs.pop('parameter3') # type: str - parameter1 = kwargs.pop('parameter1', "DefaultValue") # type: str - parameter2 = kwargs.pop('parameter2', None) # type: Optional[str] + parameter = kwargs.pop('parameter') # type: str + new_parameter = kwargs.pop('new_parameter', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/llc/parameters') + url = kwargs.pop("template_url", '/servicedriven/parameters') # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['parameter1'] = _SERIALIZER.query("parameter1", parameter1, 'str') - if parameter2 is not None: - query_parameters['parameter2'] = _SERIALIZER.query("parameter2", parameter2, 'str') - query_parameters['parameter3'] = _SERIALIZER.query("parameter3", parameter3, 'str') + query_parameters['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') + if new_parameter is not None: + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] @@ -65,3 +61,110 @@ def build_get_required_request( headers=header_parameters, **kwargs ) + + +def build_post_parameters_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """POST a JSON or a JPEG. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. I am a body parameter with a new content type. My only + valid JSON entry is { url: "http://example.org/myimage.jpeg" }. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). I am a body parameter with a new content type. My only valid + JSON entry is { url: "http://example.org/myimage.jpeg" }. + :paramtype content: any + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "image/jpeg", "application/json." + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = b'bytes' # Optional. + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/servicedriven/parameters') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_delete_parameters_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Delete something. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + """ + + # Construct URL + url = kwargs.pop("template_url", '/servicedriven/parameters') + + return HttpRequest( + method="DELETE", + url=url, + **kwargs + ) + + +def build_get_new_operation_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """I'm a new operation. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + """ + + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/servicedriven/newpath') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/_request_builders_py3.py b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/_request_builders_py3.py index 68df6a85503..d68b039c954 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/_request_builders_py3.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCUpdateOneLowLevel/llcpackagelowlevel/rest/params/_request_builders_py3.py @@ -5,7 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, IO, Optional, Union from azure.core.rest import HttpRequest from msrest import Serializer @@ -13,20 +13,16 @@ _SERIALIZER = Serializer() -def build_get_required_request( - *, parameter3: str, parameter1: str = "DefaultValue", parameter2: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_get_required_request(*, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get true Boolean value on path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. - :keyword parameter3: I am a required parameter and I'm last in Swagger. - :paramtype parameter3: str - :keyword parameter1: I am a required parameter with a client default value. - :paramtype parameter1: str - :keyword parameter2: I was a required parameter, but now I'm optional. - :paramtype parameter2: str + :keyword parameter: I am a required parameter. + :paramtype parameter: str + :keyword new_parameter: I'm a new input optional parameter. + :paramtype new_parameter: str :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. @@ -35,17 +31,100 @@ def build_get_required_request( accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/llc/parameters") + url = kwargs.pop("template_url", "/servicedriven/parameters") # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["parameter1"] = _SERIALIZER.query("parameter1", parameter1, "str") - if parameter2 is not None: - query_parameters["parameter2"] = _SERIALIZER.query("parameter2", parameter2, "str") - query_parameters["parameter3"] = _SERIALIZER.query("parameter3", parameter3, "str") + query_parameters["parameter"] = _SERIALIZER.query("parameter", parameter, "str") + if new_parameter is not None: + query_parameters["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + + +def build_post_parameters_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: + """POST a JSON or a JPEG. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. I am a body parameter with a new content type. My only + valid JSON entry is { url: "http://example.org/myimage.jpeg" }. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). I am a body parameter with a new content type. My only valid + JSON entry is { url: "http://example.org/myimage.jpeg" }. + :paramtype content: any + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "image/jpeg", "application/json." + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = b'bytes' # Optional. + """ + + content_type = kwargs.pop("content_type", None) # type: Optional[str] + + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", "/servicedriven/parameters") + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + + +def build_delete_parameters_request(**kwargs: Any) -> HttpRequest: + """Delete something. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + """ + + # Construct URL + url = kwargs.pop("template_url", "/servicedriven/parameters") + + return HttpRequest(method="DELETE", url=url, **kwargs) + + +def build_get_new_operation_request(**kwargs: Any) -> HttpRequest: + """I'm a new operation. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + """ + + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", "/servicedriven/newpath") + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCInitialVersionTolerant/llcpackageversiontolerant/aio/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCInitialVersionTolerant/llcpackageversiontolerant/aio/operations/_operations.py index f9a7c2504e8..d770e820b9b 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCInitialVersionTolerant/llcpackageversiontolerant/aio/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCInitialVersionTolerant/llcpackageversiontolerant/aio/operations/_operations.py @@ -21,7 +21,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import build_params_get_required_request +from ...operations._operations import build_params_get_required_request, build_params_post_parameters_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -46,15 +46,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_required(self, *, parameter1: str, parameter2: str, parameter3: str, **kwargs: Any) -> Any: + async def get_required(self, *, parameter: str, **kwargs: Any) -> Any: """Get true Boolean value on path. - :keyword parameter1: I am a required parameter. - :paramtype parameter1: str - :keyword parameter2: I am a required parameter. - :paramtype parameter2: str - :keyword parameter3: I am a required parameter and I'm last in Swagger. - :paramtype parameter3: str + :keyword parameter: I am a required parameter. + :paramtype parameter: str :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError @@ -64,9 +60,7 @@ async def get_required(self, *, parameter1: str, parameter2: str, parameter3: st error_map.update(kwargs.pop("error_map", {})) request = build_params_get_required_request( - parameter1=parameter1, - parameter2=parameter2, - parameter3=parameter3, + parameter=parameter, template_url=self.get_required.metadata["url"], ) request.url = self._client.format_url(request.url) @@ -88,4 +82,57 @@ async def get_required(self, *, parameter1: str, parameter2: str, parameter3: st return deserialized - get_required.metadata = {"url": "/llc/parameters"} # type: ignore + get_required.metadata = {"url": "/servicedriven/parameters"} # type: ignore + + @distributed_trace_async + async def post_parameters(self, parameter: Any, **kwargs: Any) -> Any: + """POST a JSON. + + :param parameter: I am a body parameter. My only valid JSON entry is { url: + "http://example.org/myimage.jpeg" }. + :type parameter: Any + :return: any + :rtype: any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + parameter = { + "url": "str" # Required. + } + """ + cls = kwargs.pop("cls", None) # type: ClsType[Any] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + json = parameter + + request = build_params_post_parameters_request( + content_type=content_type, + json=json, + template_url=self.post_parameters.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post_parameters.metadata = {"url": "/servicedriven/parameters"} # type: ignore diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCInitialVersionTolerant/llcpackageversiontolerant/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCInitialVersionTolerant/llcpackageversiontolerant/operations/_operations.py index 5ac9685c02b..22440b12a98 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCInitialVersionTolerant/llcpackageversiontolerant/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCInitialVersionTolerant/llcpackageversiontolerant/operations/_operations.py @@ -36,19 +36,15 @@ def build_params_get_required_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - parameter1 = kwargs.pop('parameter1') # type: str - parameter2 = kwargs.pop('parameter2') # type: str - parameter3 = kwargs.pop('parameter3') # type: str + parameter = kwargs.pop('parameter') # type: str accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/llc/parameters') + url = kwargs.pop("template_url", '/servicedriven/parameters') # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['parameter1'] = _SERIALIZER.query("parameter1", parameter1, 'str') - query_parameters['parameter2'] = _SERIALIZER.query("parameter2", parameter2, 'str') - query_parameters['parameter3'] = _SERIALIZER.query("parameter3", parameter3, 'str') + query_parameters['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] @@ -62,6 +58,30 @@ def build_params_get_required_request( **kwargs ) + +def build_params_post_parameters_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/servicedriven/parameters') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + # fmt: on class ParamsOperations(object): """ParamsOperations operations. @@ -88,12 +108,8 @@ def get_required( # type: (...) -> Any """Get true Boolean value on path. - :keyword parameter1: I am a required parameter. - :paramtype parameter1: str - :keyword parameter2: I am a required parameter. - :paramtype parameter2: str - :keyword parameter3: I am a required parameter and I'm last in Swagger. - :paramtype parameter3: str + :keyword parameter: I am a required parameter. + :paramtype parameter: str :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError @@ -102,14 +118,10 @@ def get_required( error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) - parameter1 = kwargs.pop("parameter1") # type: str - parameter2 = kwargs.pop("parameter2") # type: str - parameter3 = kwargs.pop("parameter3") # type: str + parameter = kwargs.pop("parameter") # type: str request = build_params_get_required_request( - parameter1=parameter1, - parameter2=parameter2, - parameter3=parameter3, + parameter=parameter, template_url=self.get_required.metadata["url"], ) request.url = self._client.format_url(request.url) @@ -131,4 +143,62 @@ def get_required( return deserialized - get_required.metadata = {"url": "/llc/parameters"} # type: ignore + get_required.metadata = {"url": "/servicedriven/parameters"} # type: ignore + + @distributed_trace + def post_parameters( + self, + parameter, # type: Any + **kwargs # type: Any + ): + # type: (...) -> Any + """POST a JSON. + + :param parameter: I am a body parameter. My only valid JSON entry is { url: + "http://example.org/myimage.jpeg" }. + :type parameter: Any + :return: any + :rtype: any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + parameter = { + "url": "str" # Required. + } + """ + cls = kwargs.pop("cls", None) # type: ClsType[Any] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + json = parameter + + request = build_params_post_parameters_request( + content_type=content_type, + json=json, + template_url=self.post_parameters.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post_parameters.metadata = {"url": "/servicedriven/parameters"} # type: ignore diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCUpdateOneVersionTolerant/llcpackageversiontolerant/aio/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCUpdateOneVersionTolerant/llcpackageversiontolerant/aio/operations/_operations.py index 15794a8c2a6..4a78ee36941 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCUpdateOneVersionTolerant/llcpackageversiontolerant/aio/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCUpdateOneVersionTolerant/llcpackageversiontolerant/aio/operations/_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union import warnings from azure.core.exceptions import ( @@ -21,7 +21,12 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import build_params_get_required_request +from ...operations._operations import ( + build_params_delete_parameters_request, + build_params_get_new_operation_request, + build_params_get_required_request, + build_params_post_parameters_request, +) T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -46,17 +51,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_required( - self, *, parameter3: str, parameter1: str = "DefaultValue", parameter2: Optional[str] = None, **kwargs: Any - ) -> Any: + async def get_required(self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any) -> Any: """Get true Boolean value on path. - :keyword parameter3: I am a required parameter and I'm last in Swagger. - :paramtype parameter3: str - :keyword parameter1: I am a required parameter with a client default value. - :paramtype parameter1: str - :keyword parameter2: I was a required parameter, but now I'm optional. - :paramtype parameter2: str + :keyword parameter: I am a required parameter. + :paramtype parameter: str + :keyword new_parameter: I'm a new input optional parameter. + :paramtype new_parameter: str :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError @@ -66,9 +67,8 @@ async def get_required( error_map.update(kwargs.pop("error_map", {})) request = build_params_get_required_request( - parameter3=parameter3, - parameter1=parameter1, - parameter2=parameter2, + parameter=parameter, + new_parameter=new_parameter, template_url=self.get_required.metadata["url"], ) request.url = self._client.format_url(request.url) @@ -90,4 +90,127 @@ async def get_required( return deserialized - get_required.metadata = {"url": "/llc/parameters"} # type: ignore + get_required.metadata = {"url": "/servicedriven/parameters"} # type: ignore + + @distributed_trace_async + async def post_parameters(self, parameter: Union[IO, Any], **kwargs: Any) -> Any: + """POST a JSON or a JPEG. + + :param parameter: I am a body parameter with a new content type. My only valid JSON entry is { + url: "http://example.org/myimage.jpeg" }. + :type parameter: IO or Any + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "image/jpeg", "application/json." + :return: any + :rtype: any + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[Any] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json"]: + json = parameter + elif content_type.split(";")[0] in ["image/jpeg"]: + content = parameter + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['image/jpeg', 'application/json']".format(content_type) + ) + + request = build_params_post_parameters_request( + content_type=content_type, + json=json, + content=content, + template_url=self.post_parameters.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post_parameters.metadata = {"url": "/servicedriven/parameters"} # type: ignore + + @distributed_trace_async + async def delete_parameters(self, **kwargs: Any) -> None: + """Delete something. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[None] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + request = build_params_delete_parameters_request( + template_url=self.delete_parameters.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, {}) + + delete_parameters.metadata = {"url": "/servicedriven/parameters"} # type: ignore + + @distributed_trace_async + async def get_new_operation(self, **kwargs: Any) -> Any: + """I'm a new operation. + + :return: any + :rtype: any + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[Any] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + request = build_params_get_new_operation_request( + template_url=self.get_new_operation.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_new_operation.metadata = {"url": "/servicedriven/newpath"} # type: ignore diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCUpdateOneVersionTolerant/llcpackageversiontolerant/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCUpdateOneVersionTolerant/llcpackageversiontolerant/operations/_operations.py index 9c5dedc8436..0be84759558 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCUpdateOneVersionTolerant/llcpackageversiontolerant/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCUpdateOneVersionTolerant/llcpackageversiontolerant/operations/_operations.py @@ -24,7 +24,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,20 +36,18 @@ def build_params_get_required_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - parameter3 = kwargs.pop('parameter3') # type: str - parameter1 = kwargs.pop('parameter1', "DefaultValue") # type: str - parameter2 = kwargs.pop('parameter2', None) # type: Optional[str] + parameter = kwargs.pop('parameter') # type: str + new_parameter = kwargs.pop('new_parameter', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/llc/parameters') + url = kwargs.pop("template_url", '/servicedriven/parameters') # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['parameter1'] = _SERIALIZER.query("parameter1", parameter1, 'str') - if parameter2 is not None: - query_parameters['parameter2'] = _SERIALIZER.query("parameter2", parameter2, 'str') - query_parameters['parameter3'] = _SERIALIZER.query("parameter3", parameter3, 'str') + query_parameters['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') + if new_parameter is not None: + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] @@ -63,6 +61,64 @@ def build_params_get_required_request( **kwargs ) + +def build_params_post_parameters_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/servicedriven/parameters') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_params_delete_parameters_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + # Construct URL + url = kwargs.pop("template_url", '/servicedriven/parameters') + + return HttpRequest( + method="DELETE", + url=url, + **kwargs + ) + + +def build_params_get_new_operation_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/servicedriven/newpath') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + # fmt: on class ParamsOperations(object): """ParamsOperations operations. @@ -89,12 +145,10 @@ def get_required( # type: (...) -> Any """Get true Boolean value on path. - :keyword parameter3: I am a required parameter and I'm last in Swagger. - :paramtype parameter3: str - :keyword parameter1: I am a required parameter with a client default value. - :paramtype parameter1: str - :keyword parameter2: I was a required parameter, but now I'm optional. - :paramtype parameter2: str + :keyword parameter: I am a required parameter. + :paramtype parameter: str + :keyword new_parameter: I'm a new input optional parameter. + :paramtype new_parameter: str :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError @@ -103,14 +157,12 @@ def get_required( error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) - parameter3 = kwargs.pop("parameter3") # type: str - parameter1 = kwargs.pop("parameter1", "DefaultValue") # type: str - parameter2 = kwargs.pop("parameter2", None) # type: Optional[str] + parameter = kwargs.pop("parameter") # type: str + new_parameter = kwargs.pop("new_parameter", None) # type: Optional[str] request = build_params_get_required_request( - parameter3=parameter3, - parameter1=parameter1, - parameter2=parameter2, + parameter=parameter, + new_parameter=new_parameter, template_url=self.get_required.metadata["url"], ) request.url = self._client.format_url(request.url) @@ -132,4 +184,138 @@ def get_required( return deserialized - get_required.metadata = {"url": "/llc/parameters"} # type: ignore + get_required.metadata = {"url": "/servicedriven/parameters"} # type: ignore + + @distributed_trace + def post_parameters( + self, + parameter, # type: Union[IO, Any] + **kwargs # type: Any + ): + # type: (...) -> Any + """POST a JSON or a JPEG. + + :param parameter: I am a body parameter with a new content type. My only valid JSON entry is { + url: "http://example.org/myimage.jpeg" }. + :type parameter: IO or Any + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "image/jpeg", "application/json." + :return: any + :rtype: any + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[Any] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json"]: + json = parameter + elif content_type.split(";")[0] in ["image/jpeg"]: + content = parameter + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['image/jpeg', 'application/json']".format(content_type) + ) + + request = build_params_post_parameters_request( + content_type=content_type, + json=json, + content=content, + template_url=self.post_parameters.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post_parameters.metadata = {"url": "/servicedriven/parameters"} # type: ignore + + @distributed_trace + def delete_parameters( + self, **kwargs # type: Any + ): + # type: (...) -> None + """Delete something. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[None] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + request = build_params_delete_parameters_request( + template_url=self.delete_parameters.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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, {}) + + delete_parameters.metadata = {"url": "/servicedriven/parameters"} # type: ignore + + @distributed_trace + def get_new_operation( + self, **kwargs # type: Any + ): + # type: (...) -> Any + """I'm a new operation. + + :return: any + :rtype: any + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[Any] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + request = build_params_get_new_operation_request( + template_url=self.get_new_operation.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_new_operation.metadata = {"url": "/servicedriven/newpath"} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py index cf5a2d760c5..33ac2d899cd 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py @@ -73,11 +73,11 @@ async def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py index a7b88df077e..dc686e7d11d 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py @@ -137,11 +137,11 @@ def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py index 7ce54720ed6..6672f538066 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py @@ -73,11 +73,11 @@ async def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py index cc302cccfd5..1d1e42e1976 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py @@ -137,11 +137,11 @@ def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py index bde57567c00..410714dc4e6 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py @@ -72,11 +72,11 @@ async def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py index 5d7fd4aed21..84d770d4828 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py @@ -136,11 +136,11 @@ def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py index 6ecbe743a34..785becc1ea4 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py @@ -137,11 +137,11 @@ def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py index 4d5bee7ed87..634fbcc2027 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py @@ -73,11 +73,11 @@ async def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py index 2fd77a130eb..f6cea9d4b28 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py @@ -137,11 +137,11 @@ def test_four( json = None content = None - if content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: - content = input - elif content_type.split(";")[0] in ['application/json']: + if content_type.split(";")[0] in ['application/json']: if input is not None: json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py index 8377fe3daec..84fa7d53b80 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py @@ -63,11 +63,11 @@ async def file(self, file_param: IO, **kwargs: Any) -> None: content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - content = file_param + json = file_param request = build_file_request( content_type=content_type, - content=content, + json=json, template_url=self.file.metadata["url"], ) request = _convert_request(request) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py index fa9f2a4e0f6..0324ad0b73d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py @@ -118,11 +118,11 @@ def file( content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - content = file_param + json = file_param request = build_file_request( content_type=content_type, - content=content, + json=json, template_url=self.file.metadata["url"], ) request = _convert_request(request) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py index d51899784c3..7d72768edae 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py @@ -28,6 +28,7 @@ build_analyze_body_request, build_binary_body_with_multiple_content_types_request, build_content_type_with_encoding_request, + build_put_text_and_json_body_request, ) T = TypeVar("T") @@ -59,11 +60,11 @@ async def analyze_body(self, input: Optional[Union[IO, "_models.SourcePath"]] = json = None content = None - if content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: - content = input - elif content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ["application/json"]: if input is not None: json = self._serialize.body(input, "SourcePath") + elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -122,11 +123,11 @@ async def analyze_body_no_accept_header( json = None content = None - if content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: - content = input - elif content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ["application/json"]: if input is not None: json = self._serialize.body(input, "SourcePath") + elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -171,10 +172,7 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs content_type = kwargs.pop("content_type", "text/plain") # type: Optional[str] - if input is not None: - content = self._serialize.body(input, "str") - else: - content = None + content = input request = build_content_type_with_encoding_request( content_type=content_type, @@ -222,10 +220,10 @@ async def binary_body_with_multiple_content_types(self, message: Union[IO, str], json = None content = None - if content_type.split(";")[0] in ["application/json", "application/octet-stream"]: + if content_type.split(";")[0] in ["application/json"]: + json = message + elif content_type.split(";")[0] in ["application/octet-stream", "text/plain"]: content = message - elif content_type.split(";")[0] in ["text/plain"]: - json = self._serialize.body(message, "IO") else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -260,3 +258,59 @@ async def binary_body_with_multiple_content_types(self, message: Union[IO, str], return deserialized binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore + + @distributed_trace_async + async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) -> str: + """Body that's either text/plain or application/json. + + :param message: The payload body. + :type message: str or str + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "text/plain", "application/json." + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json"]: + json = message + elif content_type.split(";")[0] in ["text/plain"]: + content = message + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['text/plain', 'application/json']".format(content_type) + ) + + request = build_put_text_and_json_body_request( + content_type=content_type, + json=json, + content=content, + template_url=self.put_text_and_json_body.metadata["url"], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + put_text_and_json_body.metadata = {"url": "/mediatypes/textAndJson"} # type: ignore diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py index 6fff03ff240..d231e7f84c3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py @@ -128,6 +128,30 @@ def build_binary_body_with_multiple_content_types_request( **kwargs ) + +def build_put_text_and_json_body_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "text/plain" + # Construct URL + url = kwargs.pop("template_url", '/mediatypes/textAndJson') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + # fmt: on class MediaTypesClientOperationsMixin(object): @distributed_trace @@ -159,11 +183,11 @@ def analyze_body( json = None content = None - if content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: - content = input - elif content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ["application/json"]: if input is not None: json = self._serialize.body(input, "SourcePath") + elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -225,11 +249,11 @@ def analyze_body_no_accept_header( json = None content = None - if content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: - content = input - elif content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ["application/json"]: if input is not None: json = self._serialize.body(input, "SourcePath") + elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -279,10 +303,7 @@ def content_type_with_encoding( content_type = kwargs.pop("content_type", "text/plain") # type: Optional[str] - if input is not None: - content = self._serialize.body(input, "str") - else: - content = None + content = input request = build_content_type_with_encoding_request( content_type=content_type, @@ -335,10 +356,10 @@ def binary_body_with_multiple_content_types( json = None content = None - if content_type.split(";")[0] in ["application/json", "application/octet-stream"]: + if content_type.split(";")[0] in ["application/json"]: + json = message + elif content_type.split(";")[0] in ["application/octet-stream", "text/plain"]: content = message - elif content_type.split(";")[0] in ["text/plain"]: - json = self._serialize.body(message, "IO") else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -373,3 +394,64 @@ def binary_body_with_multiple_content_types( return deserialized binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore + + @distributed_trace + def put_text_and_json_body( + self, + message, # type: Union[str, str] + **kwargs # type: Any + ): + # type: (...) -> str + """Body that's either text/plain or application/json. + + :param message: The payload body. + :type message: str or str + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "text/plain", "application/json." + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json"]: + json = message + elif content_type.split(";")[0] in ["text/plain"]: + content = message + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['text/plain', 'application/json']".format(content_type) + ) + + request = build_put_text_and_json_body_request( + content_type=content_type, + json=json, + content=content, + template_url=self.put_text_and_json_body.metadata["url"], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + put_text_and_json_body.metadata = {"url": "/mediatypes/textAndJson"} # type: ignore diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_binarywithcontent_typeapplicationjson.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_binarywithcontent_typeapplicationjson.py index 8cadf1814de..027b20a33bd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_binarywithcontent_typeapplicationjson.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_binarywithcontent_typeapplicationjson.py @@ -53,7 +53,7 @@ def send_request( Use these helper methods to create the request you pass to this method. >>> from bodybinarylowlevel.rest import upload - >>> request = upload.build_file_request(content=content, **kwargs) + >>> request = upload.build_file_request(json=json, content=content, **kwargs) >>> response = client.send_request(request) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_binarywithcontent_typeapplicationjson.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_binarywithcontent_typeapplicationjson.py index 2efae2ac3e1..4ad729a50e2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_binarywithcontent_typeapplicationjson.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_binarywithcontent_typeapplicationjson.py @@ -42,7 +42,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt Use these helper methods to create the request you pass to this method. >>> from bodybinarylowlevel.rest import upload - >>> request = upload.build_file_request(content=content, **kwargs) + >>> request = upload.build_file_request(json=json, content=content, **kwargs) >>> response = await client.send_request(request) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py index 1180cbef791..b2240312220 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py @@ -27,6 +27,9 @@ def build_file_request( See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. JSON file with payload { "more": "cowbell" }. + :paramtype json: any :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). JSON file with payload { "more": "cowbell" }. :paramtype content: any @@ -34,6 +37,12 @@ def build_file_request( `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = b'bytes' # Optional. """ content_type = kwargs.pop('content_type', None) # type: Optional[str] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py index c269e3b3651..164ea2b1662 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py @@ -13,12 +13,15 @@ _SERIALIZER = Serializer() -def build_file_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_file_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Uploading json file. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. JSON file with payload { "more": "cowbell" }. + :paramtype json: any :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). JSON file with payload { "more": "cowbell" }. :paramtype content: any @@ -26,6 +29,12 @@ def build_file_request(*, content: Any, **kwargs: Any) -> HttpRequest: `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = b'bytes' # Optional. """ content_type = kwargs.pop("content_type", None) # type: Optional[str] @@ -38,7 +47,7 @@ def build_file_request(*, content: Any, **kwargs: Any) -> HttpRequest: if content_type is not None: header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest(method="POST", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) def build_binary_request(*, content: Any, **kwargs: Any) -> HttpRequest: diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py index 8ef551340cd..fa0d4744e15 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py @@ -11,15 +11,18 @@ from ._request_builders_py3 import build_analyze_body_no_accept_header_request from ._request_builders_py3 import build_content_type_with_encoding_request from ._request_builders_py3 import build_binary_body_with_multiple_content_types_request + from ._request_builders_py3 import build_put_text_and_json_body_request except (SyntaxError, ImportError): from ._request_builders import build_analyze_body_request # type: ignore from ._request_builders import build_analyze_body_no_accept_header_request # type: ignore from ._request_builders import build_content_type_with_encoding_request # type: ignore from ._request_builders import build_binary_body_with_multiple_content_types_request # type: ignore + from ._request_builders import build_put_text_and_json_body_request # type: ignore __all__ = [ "build_analyze_body_request", "build_analyze_body_no_accept_header_request", "build_content_type_with_encoding_request", "build_binary_body_with_multiple_content_types_request", + "build_put_text_and_json_body_request", ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py index 748ec0f0d16..9f722814168 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py @@ -45,9 +45,7 @@ def build_analyze_body_request( .. code-block:: python # JSON input template you can fill out and use as your body input. - json = { - "source": "str" # Optional. File source path. - } + json = b'bytes' # Optional. """ content_type = kwargs.pop('content_type', None) # type: Optional[str] @@ -98,9 +96,7 @@ def build_analyze_body_no_accept_header_request( .. code-block:: python # JSON input template you can fill out and use as your body input. - json = { - "source": "str" # Optional. File source path. - } + json = b'bytes' # Optional. """ content_type = kwargs.pop('content_type', None) # type: Optional[str] @@ -186,7 +182,7 @@ def build_binary_body_with_multiple_content_types_request( .. code-block:: python # JSON input template you can fill out and use as your body input. - json = "str" # Optional. + json = b'bytes' # Optional. """ content_type = kwargs.pop('content_type', None) # type: Optional[str] @@ -207,3 +203,52 @@ def build_binary_body_with_multiple_content_types_request( headers=header_parameters, **kwargs ) + + +def build_put_text_and_json_body_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Body that's either text/plain or application/json. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. The payload body. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). The payload body. + :paramtype content: any + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "text/plain", "application/json." + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = "str" # Optional. + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "text/plain" + # Construct URL + url = kwargs.pop("template_url", '/mediatypes/textAndJson') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py index 53058ec5566..de3919de3b0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py @@ -37,9 +37,7 @@ def build_analyze_body_request(*, json: Any = None, content: Any = None, **kwarg .. code-block:: python # JSON input template you can fill out and use as your body input. - json = { - "source": "str" # Optional. File source path. - } + json = b'bytes' # Optional. """ content_type = kwargs.pop("content_type", None) # type: Optional[str] @@ -82,9 +80,7 @@ def build_analyze_body_no_accept_header_request(*, json: Any = None, content: An .. code-block:: python # JSON input template you can fill out and use as your body input. - json = { - "source": "str" # Optional. File source path. - } + json = b'bytes' # Optional. """ content_type = kwargs.pop("content_type", None) # type: Optional[str] @@ -156,7 +152,7 @@ def build_binary_body_with_multiple_content_types_request( .. code-block:: python # JSON input template you can fill out and use as your body input. - json = "str" # Optional. + json = b'bytes' # Optional. """ content_type = kwargs.pop("content_type", None) # type: Optional[str] @@ -172,3 +168,44 @@ def build_binary_body_with_multiple_content_types_request( header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + + +def build_put_text_and_json_body_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: + """Body that's either text/plain or application/json. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in + our example to find the input shape. The payload body. + :paramtype json: any + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). The payload body. + :paramtype content: any + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "text/plain", "application/json." + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + json = "str" # Optional. + """ + + content_type = kwargs.pop("content_type", None) # type: Optional[str] + + accept = "text/plain" + # Construct URL + url = kwargs.pop("template_url", "/mediatypes/textAndJson") + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_binary.py b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_binary.py index 452a282748b..a92159d0d4a 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_binary.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_binary.py @@ -35,7 +35,7 @@ async def client(): @pytest.mark.asyncio async def test_upload_file(client): - await client.upload.file(json.dumps({"more": "cowbell"})) + await client.upload.file(b'{"more": "cowbell"}') @pytest.mark.asyncio async def test_upload_binary(client): diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py index 857054baceb..f9b64b8d25b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py @@ -61,11 +61,11 @@ async def file(self, file_param: IO, **kwargs: Any) -> None: content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - content = file_param + json = file_param request = build_upload_file_request( content_type=content_type, - content=content, + json=json, template_url=self.file.metadata["url"], ) request.url = self._client.format_url(request.url) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py index e7f146eada7..cccf37dd43e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py @@ -115,11 +115,11 @@ def file( content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - content = file_param + json = file_param request = build_upload_file_request( content_type=content_type, - content=content, + json=json, template_url=self.file.metadata["url"], ) request.url = self._client.format_url(request.url) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py index 60feefca231..19fc1f84026 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py @@ -26,6 +26,7 @@ build_analyze_body_request, build_binary_body_with_multiple_content_types_request, build_content_type_with_encoding_request, + build_put_text_and_json_body_request, ) T = TypeVar("T") @@ -62,11 +63,11 @@ async def analyze_body(self, input: Optional[Union[IO, Any]] = None, **kwargs: A json = None content = None - if content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: - content = input - elif content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ["application/json"]: if input is not None: json = input + elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -130,11 +131,11 @@ async def analyze_body_no_accept_header(self, input: Optional[Union[IO, Any]] = json = None content = None - if content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: - content = input - elif content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ["application/json"]: if input is not None: json = input + elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -177,10 +178,7 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs content_type = kwargs.pop("content_type", "text/plain") # type: Optional[str] - if input is not None: - content = input - else: - content = None + content = input request = build_content_type_with_encoding_request( content_type=content_type, @@ -229,10 +227,10 @@ async def binary_body_with_multiple_content_types(self, message: Union[IO, str], json = None content = None - if content_type.split(";")[0] in ["application/json", "application/octet-stream"]: - content = message - elif content_type.split(";")[0] in ["text/plain"]: + if content_type.split(";")[0] in ["application/json"]: json = message + elif content_type.split(";")[0] in ["application/octet-stream", "text/plain"]: + content = message else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -272,3 +270,60 @@ async def binary_body_with_multiple_content_types(self, message: Union[IO, str], return deserialized binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore + + @distributed_trace_async + async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) -> str: + """Body that's either text/plain or application/json. + + :param message: The payload body. + :type message: str or str + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "text/plain", "application/json." + :return: str + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json"]: + json = message + elif content_type.split(";")[0] in ["text/plain"]: + content = message + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['text/plain', 'application/json']".format(content_type) + ) + + request = build_put_text_and_json_body_request( + content_type=content_type, + json=json, + content=content, + template_url=self.put_text_and_json_body.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + put_text_and_json_body.metadata = {"url": "/mediatypes/textAndJson"} # type: ignore diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py index 878074db464..f1dcde4dd95 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py @@ -125,6 +125,30 @@ def build_binary_body_with_multiple_content_types_request( **kwargs ) + +def build_put_text_and_json_body_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "text/plain" + # Construct URL + url = kwargs.pop("template_url", '/mediatypes/textAndJson') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + # fmt: on class MediaTypesClientOperationsMixin(object): @distributed_trace @@ -161,11 +185,11 @@ def analyze_body( json = None content = None - if content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: - content = input - elif content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ["application/json"]: if input is not None: json = input + elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -234,11 +258,11 @@ def analyze_body_no_accept_header( json = None content = None - if content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: - content = input - elif content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ["application/json"]: if input is not None: json = input + elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + content = input else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -286,10 +310,7 @@ def content_type_with_encoding( content_type = kwargs.pop("content_type", "text/plain") # type: Optional[str] - if input is not None: - content = input - else: - content = None + content = input request = build_content_type_with_encoding_request( content_type=content_type, @@ -343,10 +364,10 @@ def binary_body_with_multiple_content_types( json = None content = None - if content_type.split(";")[0] in ["application/json", "application/octet-stream"]: - content = message - elif content_type.split(";")[0] in ["text/plain"]: + if content_type.split(";")[0] in ["application/json"]: json = message + elif content_type.split(";")[0] in ["application/octet-stream", "text/plain"]: + content = message else: raise ValueError( "The content_type '{}' is not one of the allowed values: " @@ -386,3 +407,65 @@ def binary_body_with_multiple_content_types( return deserialized binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore + + @distributed_trace + def put_text_and_json_body( + self, + message, # type: Union[str, str] + **kwargs # type: Any + ): + # type: (...) -> str + """Body that's either text/plain or application/json. + + :param message: The payload body. + :type message: str or str + :keyword str content_type: Media type of the body sent to the API. Default value is + "application/json". Allowed values are: "text/plain", "application/json." + :return: str + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json"]: + json = message + elif content_type.split(";")[0] in ["text/plain"]: + content = message + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['text/plain', 'application/json']".format(content_type) + ) + + request = build_put_text_and_json_body_request( + content_type=content_type, + json=json, + content=content, + template_url=self.put_text_and_json_body.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + put_text_and_json_body.metadata = {"url": "/mediatypes/textAndJson"} # type: ignore From e302e46095308595bf6f21b12fe0ea04e702ffa9 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 29 Oct 2021 16:27:13 -0700 Subject: [PATCH 05/23] fix xml check --- autorest/codegen/serializers/builder_serializer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autorest/codegen/serializers/builder_serializer.py b/autorest/codegen/serializers/builder_serializer.py index d974150940d..bd8bb0bdf86 100644 --- a/autorest/codegen/serializers/builder_serializer.py +++ b/autorest/codegen/serializers/builder_serializer.py @@ -725,7 +725,11 @@ def _serialize_body_call( def _serialize_body(self, builder: BuilderType, body_param: Parameter, body_kwarg: str) -> List[str]: retval = [] - send_xml = bool(builder.parameters.has_body and any(["xml" in ct for ct in builder.parameters.content_types])) + send_xml = bool( + builder.parameters.has_body and + any(["xml" in ct for ct in builder.parameters.content_types]) and + not isinstance(body_param.schema, IOSchema) + ) ser_ctxt_name = "serialization_ctxt" ser_ctxt = builder.parameters.body[0].xml_serialization_ctxt if send_xml else None if ser_ctxt: From 8fbbaaaa6ac8ca0dc3264357b4caa5397205d693 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 1 Nov 2021 08:00:29 -0700 Subject: [PATCH 06/23] regen urlencoded with bug --- .../_formdataurlencoded_operations.py | 56 ++++++++++++- .../bodyformurlencodeddata/models/__init__.py | 5 ++ .../bodyformurlencodeddata/models/_models.py | 48 +++++++++++ .../models/_models_py3.py | 48 +++++++++++ .../_formdataurlencoded_operations.py | 80 +++++++++++++++++++ .../rest/formdataurlencoded/__init__.py | 3 + .../formdataurlencoded/_request_builders.py | 47 +++++++++++ .../_request_builders_py3.py | 39 +++++++++ .../aio/operations/_operations.py | 51 +++++++++++- .../operations/_operations.py | 74 +++++++++++++++++ 10 files changed, 449 insertions(+), 2 deletions(-) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py index 3d832b5f446..e4b7b8ae9ab 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py @@ -23,7 +23,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._formdataurlencoded_operations import build_update_pet_with_form_request +from ...operations._formdataurlencoded_operations import ( + build_partial_constant_body_request, + build_update_pet_with_form_request, +) T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -118,3 +121,54 @@ async def update_pet_with_form( return cls(pipeline_response, None, {}) update_pet_with_form.metadata = {"url": "/formsdataurlencoded/pet/add/{petId}"} # type: ignore + + @distributed_trace_async + async def partial_constant_body(self, service: str, access_token: str, **kwargs: Any) -> None: + """Test a partially constant formdata body. + + :param service: Indicates the name of your Azure container registry. + :type service: str + :param access_token: AAD access token, mandatory when grant_type is access_token_refresh_token + or access_token. + :type access_token: str + :keyword grant_type: Constant part of a formdata body. The default value is "access_token". + Note that overriding this default value may result in unsupported behavior. + :paramtype grant_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[None] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + grant_type = kwargs.pop("grant_type", "access_token") # type: str + + # Construct form data + data = { + "grant_type": grant_type, + "service": service, + "access_token": access_token, + } + + request = build_partial_constant_body_request( + content_type=content_type, + content=data, + template_url=self.partial_constant_body.metadata["url"], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + + if cls: + return cls(pipeline_response, None, {}) + + partial_constant_body.metadata = {"url": "/formsdataurlencoded/partialConstantBody"} # type: ignore diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py index 6a6c3a0437f..1c96c835392 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py @@ -10,8 +10,12 @@ from ._models_py3 import ( Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, ) + from ._models_py3 import ( + PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, + ) except (SyntaxError, ImportError): from ._models import Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema # type: ignore + from ._models import PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema # type: ignore from ._body_forms_data_url_encoded_enums import ( PetFood, @@ -20,6 +24,7 @@ __all__ = [ "Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema", + "PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema", "PetFood", "PetType", ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models.py index 91006af9a52..2e852d6497d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models.py @@ -67,3 +67,51 @@ def __init__(self, **kwargs): self.pet_age = kwargs["pet_age"] self.name = kwargs.get("name", None) self.status = kwargs.get("status", None) + + +class PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema( + msrest.serialization.Model +): + """PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar grant_type: Constant part of a formdata body. Has constant value: "access_token". + :vartype grant_type: str + :ivar service: Required. Indicates the name of your Azure container registry. + :vartype service: str + :ivar aad_access_token: Required. AAD access token, mandatory when grant_type is + access_token_refresh_token or access_token. + :vartype aad_access_token: str + """ + + _validation = { + "grant_type": {"required": True, "constant": True}, + "service": {"required": True}, + "aad_access_token": {"required": True}, + } + + _attribute_map = { + "grant_type": {"key": "grant_type", "type": "str"}, + "service": {"key": "service", "type": "str"}, + "aad_access_token": {"key": "access_token", "type": "str"}, + } + + grant_type = "access_token" + + def __init__(self, **kwargs): + """ + :keyword service: Required. Indicates the name of your Azure container registry. + :paramtype service: str + :keyword aad_access_token: Required. AAD access token, mandatory when grant_type is + access_token_refresh_token or access_token. + :paramtype aad_access_token: str + """ + super( + PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, + self, + ).__init__(**kwargs) + self.service = kwargs["service"] + self.aad_access_token = kwargs["aad_access_token"] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models_py3.py index b1a76f2bc76..6f6e2642e53 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models_py3.py @@ -80,3 +80,51 @@ def __init__( self.pet_age = pet_age self.name = name self.status = status + + +class PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema( + msrest.serialization.Model +): + """PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar grant_type: Constant part of a formdata body. Has constant value: "access_token". + :vartype grant_type: str + :ivar service: Required. Indicates the name of your Azure container registry. + :vartype service: str + :ivar aad_access_token: Required. AAD access token, mandatory when grant_type is + access_token_refresh_token or access_token. + :vartype aad_access_token: str + """ + + _validation = { + "grant_type": {"required": True, "constant": True}, + "service": {"required": True}, + "aad_access_token": {"required": True}, + } + + _attribute_map = { + "grant_type": {"key": "grant_type", "type": "str"}, + "service": {"key": "service", "type": "str"}, + "aad_access_token": {"key": "access_token", "type": "str"}, + } + + grant_type = "access_token" + + def __init__(self, *, service: str, aad_access_token: str, **kwargs): + """ + :keyword service: Required. Indicates the name of your Azure container registry. + :paramtype service: str + :keyword aad_access_token: Required. AAD access token, mandatory when grant_type is + access_token_refresh_token or access_token. + :paramtype aad_access_token: str + """ + super( + PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, + self, + ).__init__(**kwargs) + self.service = service + self.aad_access_token = aad_access_token diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py index 915c7a851a2..f6926fc7293 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py @@ -62,6 +62,29 @@ def build_update_pet_with_form_request( **kwargs ) + +def build_partial_constant_body_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + content = kwargs.pop('content', "access_token") # type: str + + # Construct URL + url = kwargs.pop("template_url", '/formsdataurlencoded/partialConstantBody') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + # fmt: on class FormdataurlencodedOperations(object): """FormdataurlencodedOperations operations. @@ -153,3 +176,60 @@ def update_pet_with_form( return cls(pipeline_response, None, {}) update_pet_with_form.metadata = {"url": "/formsdataurlencoded/pet/add/{petId}"} # type: ignore + + @distributed_trace + def partial_constant_body( + self, + service, # type: str + access_token, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Test a partially constant formdata body. + + :param service: Indicates the name of your Azure container registry. + :type service: str + :param access_token: AAD access token, mandatory when grant_type is access_token_refresh_token + or access_token. + :type access_token: str + :keyword grant_type: Constant part of a formdata body. The default value is "access_token". + Note that overriding this default value may result in unsupported behavior. + :paramtype grant_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[None] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + grant_type = kwargs.pop("grant_type", "access_token") # type: str + + # Construct form data + data = { + "grant_type": grant_type, + "service": service, + "access_token": access_token, + } + + request = build_partial_constant_body_request( + content_type=content_type, + content=data, + template_url=self.partial_constant_body.metadata["url"], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + + if cls: + return cls(pipeline_response, None, {}) + + partial_constant_body.metadata = {"url": "/formsdataurlencoded/partialConstantBody"} # type: ignore diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py index 19262e50205..c2a1a3cee7d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py @@ -8,9 +8,12 @@ try: from ._request_builders_py3 import build_update_pet_with_form_request + from ._request_builders_py3 import build_partial_constant_body_request except (SyntaxError, ImportError): from ._request_builders import build_update_pet_with_form_request # type: ignore + from ._request_builders import build_partial_constant_body_request # type: ignore __all__ = [ "build_update_pet_with_form_request", + "build_partial_constant_body_request", ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py index e0b72ec8cde..7b2ad57b89a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py @@ -79,3 +79,50 @@ def build_update_pet_with_form_request( headers=header_parameters, **kwargs ) + + +def build_partial_constant_body_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + """Test a partially constant formdata body. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword content: Constant part of a formdata body. The default value is "access_token". Note + that overriding this default value may result in unsupported behavior. + :paramtype content: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # form-encoded input template you can fill out and use as your `data` input. + data = { + access_token: "str", # AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. + content: "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. + service: "str" # Indicates the name of your Azure container registry. + } + """ + + content_type = kwargs.pop('content_type', None) # type: Optional[str] + content = kwargs.pop('content', "access_token") # type: str + + # Construct URL + url = kwargs.pop("template_url", '/formsdataurlencoded/partialConstantBody') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py index 467c02eb130..812ed2f63c8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py @@ -67,3 +67,42 @@ def build_update_pet_with_form_request( header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=url, headers=header_parameters, data=data, content=content, **kwargs) + + +def build_partial_constant_body_request(**kwargs: Any) -> HttpRequest: + """Test a partially constant formdata body. + + See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder + into your code flow. + + :keyword content: Constant part of a formdata body. The default value is "access_token". Note + that overriding this default value may result in unsupported behavior. + :paramtype content: str + :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's + `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to + incorporate this response into your code flow. + :rtype: ~azure.core.rest.HttpRequest + + Example: + .. code-block:: python + + # form-encoded input template you can fill out and use as your `data` input. + data = { + access_token: "str", # AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. + content: "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. + service: "str" # Indicates the name of your Azure container registry. + } + """ + + content_type = kwargs.pop("content_type", None) # type: Optional[str] + content = kwargs.pop("content", "access_token") # type: str + + # Construct URL + url = kwargs.pop("template_url", "/formsdataurlencoded/partialConstantBody") + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=url, headers=header_parameters, data=data, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py index 35ed23d17b5..730b6c4888a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py @@ -21,7 +21,10 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import build_formdataurlencoded_update_pet_with_form_request +from ...operations._operations import ( + build_formdataurlencoded_partial_constant_body_request, + build_formdataurlencoded_update_pet_with_form_request, +) T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,3 +100,49 @@ async def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs return cls(pipeline_response, None, {}) update_pet_with_form.metadata = {"url": "/formsdataurlencoded/pet/add/{petId}"} # type: ignore + + @distributed_trace_async + async def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> None: + """Test a partially constant formdata body. + + :param data: Form-encoded input for data. See the template in our example to find the input + shape. + :type data: dict[str, any] + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # form-encoded input template you can fill out and use as your `data` input. + data = { + access_token: "str", # AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. + grant_type: "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. + service: "str" # Indicates the name of your Azure container registry. + } + """ + cls = kwargs.pop("cls", None) # type: ClsType[None] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + + request = build_formdataurlencoded_partial_constant_body_request( + content_type=content_type, + content=data, + template_url=self.partial_constant_body.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + + if cls: + return cls(pipeline_response, None, {}) + + partial_constant_body.metadata = {"url": "/formsdataurlencoded/partialConstantBody"} # type: ignore diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py index bf9742be004..069423e5cca 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py @@ -61,6 +61,29 @@ def build_formdataurlencoded_update_pet_with_form_request( **kwargs ) + +def build_formdataurlencoded_partial_constant_body_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + content = kwargs.pop('content', "access_token") # type: str + + # Construct URL + url = kwargs.pop("template_url", '/formsdataurlencoded/partialConstantBody') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + # fmt: on class FormdataurlencodedOperations(object): """FormdataurlencodedOperations operations. @@ -138,3 +161,54 @@ def update_pet_with_form( return cls(pipeline_response, None, {}) update_pet_with_form.metadata = {"url": "/formsdataurlencoded/pet/add/{petId}"} # type: ignore + + @distributed_trace + def partial_constant_body( + self, + data, # type: Dict[str, Any] + **kwargs # type: Any + ): + # type: (...) -> None + """Test a partially constant formdata body. + + :param data: Form-encoded input for data. See the template in our example to find the input + shape. + :type data: dict[str, any] + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # form-encoded input template you can fill out and use as your `data` input. + data = { + access_token: "str", # AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. + grant_type: "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. + service: "str" # Indicates the name of your Azure container registry. + } + """ + cls = kwargs.pop("cls", None) # type: ClsType[None] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + + request = build_formdataurlencoded_partial_constant_body_request( + content_type=content_type, + content=data, + template_url=self.partial_constant_body.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + + if cls: + return cls(pipeline_response, None, {}) + + partial_constant_body.metadata = {"url": "/formsdataurlencoded/partialConstantBody"} # type: ignore From 6013c052382aa8672dc85891083250e6cdce2727 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 1 Nov 2021 10:00:29 -0700 Subject: [PATCH 07/23] fix case for constant data kwargs --- .../models/request_builder_parameter_list.py | 35 +++++++++++-------- .../_formdataurlencoded_operations.py | 2 +- .../_formdataurlencoded_operations.py | 3 +- .../formdataurlencoded/_request_builders.py | 12 ++++--- .../_request_builders_py3.py | 18 ++++++---- .../aio/operations/_operations.py | 2 +- .../operations/_operations.py | 3 +- 7 files changed, 42 insertions(+), 33 deletions(-) diff --git a/autorest/codegen/models/request_builder_parameter_list.py b/autorest/codegen/models/request_builder_parameter_list.py index 9f8c5da667e..9371a1864f8 100644 --- a/autorest/codegen/models/request_builder_parameter_list.py +++ b/autorest/codegen/models/request_builder_parameter_list.py @@ -58,20 +58,35 @@ def body_kwargs_to_get(self) -> List[Parameter]: return [] return [b for b in self.body if b.content_types] - def add_body_kwargs(self) -> None: # pylint: disable=too-many-statements + def _update_constant_params(self): + # we don't currently have a fully constant data or files input + # so we don't need to modify the body kwarg + constant_bodies = [ + p for p in self.parameters + if p.location == ParameterLocation.Body + and p.constant + and not p.is_data_input + and not p.is_multipart + ] + for constant_body in constant_bodies: + if self._is_json(constant_body): + constant_body.serialized_name = "json" + else: + constant_body.serialized_name = "content" + + def add_body_kwargs(self) -> None: + self._update_constant_params() try: body_kwargs_added = [] body_method_param = next( - p for p in self.parameters if p.location == ParameterLocation.Body + p for p in self.parameters + if p.location == ParameterLocation.Body and not p.constant ) except StopIteration: pass else: - serialized_name: str = "" - content_types_to_assign = copy(self.content_types) if body_method_param.is_multipart: - serialized_name = "files" file_kwarg = copy(body_method_param) self._change_body_param_name(file_kwarg, "files") file_kwarg.schema = DictionarySchema( @@ -91,7 +106,6 @@ def add_body_kwargs(self) -> None: # pylint: disable=too-many-statements content_types_to_assign = _update_content_types(content_types_to_assign, file_kwarg) body_kwargs_added.append(file_kwarg) if body_method_param.is_data_input: - serialized_name = "data" data_kwarg = copy(body_method_param) self._change_body_param_name(data_kwarg, "data") data_kwarg.schema = DictionarySchema( @@ -110,16 +124,7 @@ def add_body_kwargs(self) -> None: # pylint: disable=too-many-statements ] content_types_to_assign = _update_content_types(content_types_to_assign, data_kwarg) body_kwargs_added.append(data_kwarg) - if body_method_param.constant: - # we don't add body kwargs for constant bodies - if not serialized_name and self._is_json(body_method_param): - serialized_name = "json" - else: - serialized_name = "content" - body_method_param.serialized_name = serialized_name - return if self._is_json(body_method_param): - serialized_name = "json" json_kwarg = copy(body_method_param) self._change_body_param_name(json_kwarg, "json") json_kwarg.description = ( diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py index e4b7b8ae9ab..0921191358f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py @@ -155,7 +155,7 @@ async def partial_constant_body(self, service: str, access_token: str, **kwargs: request = build_partial_constant_body_request( content_type=content_type, - content=data, + data=data, template_url=self.partial_constant_body.metadata["url"], ) request = _convert_request(request) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py index f6926fc7293..1b58d01c4d7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py @@ -68,7 +68,6 @@ def build_partial_constant_body_request( ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] - content = kwargs.pop('content', "access_token") # type: str # Construct URL url = kwargs.pop("template_url", '/formsdataurlencoded/partialConstantBody') @@ -216,7 +215,7 @@ def partial_constant_body( request = build_partial_constant_body_request( content_type=content_type, - content=data, + data=data, template_url=self.partial_constant_body.metadata["url"], ) request = _convert_request(request) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py index 7b2ad57b89a..2ee4ad4087e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py @@ -90,9 +90,12 @@ def build_partial_constant_body_request( See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. - :keyword content: Constant part of a formdata body. The default value is "access_token". Note - that overriding this default value may result in unsupported behavior. - :paramtype content: str + :keyword data: Pass in dictionary that contains form data to include in the body of the + request. Indicates the name of your Azure container registry. + :paramtype data: dict[str, any] + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). Indicates the name of your Azure container registry. + :paramtype content: any :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. @@ -104,13 +107,12 @@ def build_partial_constant_body_request( # form-encoded input template you can fill out and use as your `data` input. data = { access_token: "str", # AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. - content: "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. + grant_type: "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. service: "str" # Indicates the name of your Azure container registry. } """ content_type = kwargs.pop('content_type', None) # type: Optional[str] - content = kwargs.pop('content', "access_token") # type: str # Construct URL url = kwargs.pop("template_url", '/formsdataurlencoded/partialConstantBody') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py index 812ed2f63c8..7a631ddbd83 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py @@ -69,15 +69,20 @@ def build_update_pet_with_form_request( return HttpRequest(method="POST", url=url, headers=header_parameters, data=data, content=content, **kwargs) -def build_partial_constant_body_request(**kwargs: Any) -> HttpRequest: +def build_partial_constant_body_request( + *, data: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test a partially constant formdata body. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. - :keyword content: Constant part of a formdata body. The default value is "access_token". Note - that overriding this default value may result in unsupported behavior. - :paramtype content: str + :keyword data: Pass in dictionary that contains form data to include in the body of the + request. Indicates the name of your Azure container registry. + :paramtype data: dict[str, any] + :keyword content: Pass in binary content you want in the body of the request (typically bytes, + a byte iterator, or stream input). Indicates the name of your Azure container registry. + :paramtype content: any :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. @@ -89,13 +94,12 @@ def build_partial_constant_body_request(**kwargs: Any) -> HttpRequest: # form-encoded input template you can fill out and use as your `data` input. data = { access_token: "str", # AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. - content: "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. + grant_type: "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. service: "str" # Indicates the name of your Azure container registry. } """ content_type = kwargs.pop("content_type", None) # type: Optional[str] - content = kwargs.pop("content", "access_token") # type: str # Construct URL url = kwargs.pop("template_url", "/formsdataurlencoded/partialConstantBody") @@ -105,4 +109,4 @@ def build_partial_constant_body_request(**kwargs: Any) -> HttpRequest: if content_type is not None: header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest(method="POST", url=url, headers=header_parameters, data=data, **kwargs) + return HttpRequest(method="POST", url=url, headers=header_parameters, data=data, content=content, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py index 730b6c4888a..23bf3989133 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py @@ -130,7 +130,7 @@ async def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> No request = build_formdataurlencoded_partial_constant_body_request( content_type=content_type, - content=data, + data=data, template_url=self.partial_constant_body.metadata["url"], ) request.url = self._client.format_url(request.url) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py index 069423e5cca..e9d0743805a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py @@ -67,7 +67,6 @@ def build_formdataurlencoded_partial_constant_body_request( ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] - content = kwargs.pop('content', "access_token") # type: str # Construct URL url = kwargs.pop("template_url", '/formsdataurlencoded/partialConstantBody') @@ -196,7 +195,7 @@ def partial_constant_body( request = build_formdataurlencoded_partial_constant_body_request( content_type=content_type, - content=data, + data=data, template_url=self.partial_constant_body.metadata["url"], ) request.url = self._client.format_url(request.url) From 64effd56e2073cba1681a8cd74fbee73b21e8dca Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 1 Nov 2021 10:29:49 -0700 Subject: [PATCH 08/23] add new tests --- .../aio/operations/_operations.py | 75 ++++++++++++- .../operations/_operations.py | 105 ++++++++++++++++-- 2 files changed, 167 insertions(+), 13 deletions(-) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py index 19fc1f84026..0c47a110c1c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py @@ -24,7 +24,8 @@ from ...operations._operations import ( build_analyze_body_no_accept_header_request, build_analyze_body_request, - build_binary_body_with_multiple_content_types_request, + build_binary_body_with_three_content_types_request, + build_binary_body_with_two_content_types_request, build_content_type_with_encoding_request, build_put_text_and_json_body_request, ) @@ -207,8 +208,70 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs content_type_with_encoding.metadata = {"url": "/mediatypes/contentTypeWithEncoding"} # type: ignore @distributed_trace_async - async def binary_body_with_multiple_content_types(self, message: Union[IO, str], **kwargs: Any) -> str: - """Binary body with three content types. They should be grouped by body type. + async def binary_body_with_two_content_types(self, message: IO, **kwargs: Any) -> str: + """Binary body with two content types. + + :param message: The payload body. + :type message: IO + :return: str + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", None) # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json"]: + json = message + elif content_type.split(";")[0] in ["application/octet-stream"]: + content = message + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/json', 'application/octet-stream']".format(content_type) + ) + + request = build_binary_body_with_two_content_types_request( + content_type=content_type, + json=json, + content=content, + template_url=self.binary_body_with_two_content_types.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.status_code == 200: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 200: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + binary_body_with_two_content_types.metadata = {"url": "/mediatypes/binaryBodyTwoContentTypes"} # type: ignore + + @distributed_trace_async + async def binary_body_with_three_content_types(self, message: Union[IO, str], **kwargs: Any) -> str: + """Binary body with three content types. :param message: The payload body. :type message: IO or str @@ -237,11 +300,11 @@ async def binary_body_with_multiple_content_types(self, message: Union[IO, str], "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_binary_body_with_multiple_content_types_request( + request = build_binary_body_with_three_content_types_request( content_type=content_type, json=json, content=content, - template_url=self.binary_body_with_multiple_content_types.metadata["url"], + template_url=self.binary_body_with_three_content_types.metadata["url"], ) request.url = self._client.format_url(request.url) @@ -269,7 +332,7 @@ async def binary_body_with_multiple_content_types(self, message: Union[IO, str], return deserialized - binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore + binary_body_with_three_content_types.metadata = {"url": "/mediatypes/binaryBodyThreeContentTypes"} # type: ignore @distributed_trace_async async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) -> str: diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py index f1dcde4dd95..1833b516c0b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py @@ -102,7 +102,7 @@ def build_content_type_with_encoding_request( ) -def build_binary_body_with_multiple_content_types_request( +def build_binary_body_with_two_content_types_request( **kwargs # type: Any ): # type: (...) -> HttpRequest @@ -110,7 +110,31 @@ def build_binary_body_with_multiple_content_types_request( accept = "text/plain, application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/mediatypes/binaryBody') + url = kwargs.pop("template_url", '/mediatypes/binaryBodyTwoContentTypes') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_binary_body_with_three_content_types_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "text/plain, application/json, text/json" + # Construct URL + url = kwargs.pop("template_url", '/mediatypes/binaryBodyThreeContentTypes') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] @@ -339,13 +363,80 @@ def content_type_with_encoding( content_type_with_encoding.metadata = {"url": "/mediatypes/contentTypeWithEncoding"} # type: ignore @distributed_trace - def binary_body_with_multiple_content_types( + def binary_body_with_two_content_types( + self, + message, # type: IO + **kwargs # type: Any + ): + # type: (...) -> str + """Binary body with two content types. + + :param message: The payload body. + :type message: IO + :return: str + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop("cls", None) # type: ClsType[str] + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {})) + + content_type = kwargs.pop("content_type", None) # type: Optional[str] + + json = None + content = None + if content_type.split(";")[0] in ["application/json"]: + json = message + elif content_type.split(";")[0] in ["application/octet-stream"]: + content = message + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/json', 'application/octet-stream']".format(content_type) + ) + + request = build_binary_body_with_two_content_types_request( + content_type=content_type, + json=json, + content=content, + template_url=self.binary_body_with_two_content_types.metadata["url"], + ) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.status_code == 200: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 200: + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + binary_body_with_two_content_types.metadata = {"url": "/mediatypes/binaryBodyTwoContentTypes"} # type: ignore + + @distributed_trace + def binary_body_with_three_content_types( self, message, # type: Union[IO, str] **kwargs # type: Any ): # type: (...) -> str - """Binary body with three content types. They should be grouped by body type. + """Binary body with three content types. :param message: The payload body. :type message: IO or str @@ -374,11 +465,11 @@ def binary_body_with_multiple_content_types( "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_binary_body_with_multiple_content_types_request( + request = build_binary_body_with_three_content_types_request( content_type=content_type, json=json, content=content, - template_url=self.binary_body_with_multiple_content_types.metadata["url"], + template_url=self.binary_body_with_three_content_types.metadata["url"], ) request.url = self._client.format_url(request.url) @@ -406,7 +497,7 @@ def binary_body_with_multiple_content_types( return deserialized - binary_body_with_multiple_content_types.metadata = {"url": "/mediatypes/binaryBody"} # type: ignore + binary_body_with_three_content_types.metadata = {"url": "/mediatypes/binaryBodyThreeContentTypes"} # type: ignore @distributed_trace def put_text_and_json_body( From 940bedc43203a0d1e468b9ea9dbd4a0b6c9f29fb Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 2 Nov 2021 10:56:22 -0700 Subject: [PATCH 09/23] add binary body testserver tests --- .../AcceptanceTests/asynctests/test_media_types.py | 8 ++++++++ .../legacy/AcceptanceTests/test_media_types.py | 7 +++++++ .../AcceptanceTests/asynctests/test_media_types.py | 12 +++++++++++- .../low-level/AcceptanceTests/test_media_types.py | 12 ++++++++++-- .../AcceptanceTests/asynctests/test_media_types.py | 8 ++++++++ .../AcceptanceTests/test_media_types.py | 7 +++++++ 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py b/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py index a40c0854cbf..e189785d38c 100644 --- a/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py +++ b/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py @@ -69,3 +69,11 @@ async def test_pdf_no_accept_header(self, client): async def test_json_no_accept_header(self, client): json_input = json.loads('{"source":"foo"}') await client.analyze_body_no_accept_header(input=json_input) + + @pytest.mark.asyncio + async def test_binary_body_two_content_types(self, client): + json_input = {"hello":"world"} + await client.binary_body_with_two_content_types(json_input, content_type="application/json") + + content = b"hello, world" + await client.binary_body_with_two_content_types(content, content_type="application/octet-stream") diff --git a/test/vanilla/legacy/AcceptanceTests/test_media_types.py b/test/vanilla/legacy/AcceptanceTests/test_media_types.py index fa5ecbf62b8..49ff5a4e5f4 100644 --- a/test/vanilla/legacy/AcceptanceTests/test_media_types.py +++ b/test/vanilla/legacy/AcceptanceTests/test_media_types.py @@ -62,6 +62,13 @@ def test_json_no_accept_header(self, client): json_input = json.loads('{"source":"foo"}') client.analyze_body_no_accept_header(input=json_input) + def test_binary_body_two_content_types(self, client): + json_input = {"hello":"world"} + client.binary_body_with_two_content_types(json_input, content_type="application/json") + + content = b"hello, world" + client.binary_body_with_two_content_types(content, content_type="application/octet-stream") + def test_models(self): from mediatypes.models import SourcePath diff --git a/test/vanilla/low-level/AcceptanceTests/asynctests/test_media_types.py b/test/vanilla/low-level/AcceptanceTests/asynctests/test_media_types.py index fef8397ddce..41dcb716445 100644 --- a/test/vanilla/low-level/AcceptanceTests/asynctests/test_media_types.py +++ b/test/vanilla/low-level/AcceptanceTests/asynctests/test_media_types.py @@ -70,4 +70,14 @@ async def test_pdf_no_accept_header(send_request): @pytest.mark.asyncio async def test_json_no_accept_header(send_request): request = build_analyze_body_no_accept_header_request(json={"source":"foo"}) - await send_request(request) \ No newline at end of file + await send_request(request) + +@pytest.mark.asyncio +async def test_binary_body_two_content_types(send_request): + json_input = {"hello":"world"} + request = build_binary_body_with_two_content_types_request(json=json_input, content_type="application/json") + await send_request(request) + + content = b"hello, world" + request = build_binary_body_with_two_content_types_request(content=content, content_type="application/octet-stream") + await send_request(request) diff --git a/test/vanilla/low-level/AcceptanceTests/test_media_types.py b/test/vanilla/low-level/AcceptanceTests/test_media_types.py index c30b69399ec..9e4164f7904 100644 --- a/test/vanilla/low-level/AcceptanceTests/test_media_types.py +++ b/test/vanilla/low-level/AcceptanceTests/test_media_types.py @@ -24,8 +24,7 @@ # # -------------------------------------------------------------------------- from mediatypeslowlevel import MediaTypesClient -from mediatypeslowlevel.rest import build_analyze_body_request, build_content_type_with_encoding_request, build_analyze_body_no_accept_header_request - +from mediatypeslowlevel.rest import * import pytest @pytest.fixture @@ -64,3 +63,12 @@ def test_pdf_no_accept_header(send_request): def test_json_no_accept_header(send_request): request = build_analyze_body_no_accept_header_request(json={"source":"foo"}) send_request(request) + +def test_binary_body_two_content_types(send_request): + json_input = {"hello":"world"} + request = build_binary_body_with_two_content_types_request(json=json_input, content_type="application/json") + send_request(request) + + content = b"hello, world" + request = build_binary_body_with_two_content_types_request(content=content, content_type="application/octet-stream") + send_request(request) diff --git a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py index ae7e0e30c54..596d5cb59ee 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_media_types.py @@ -65,3 +65,11 @@ async def test_pdf_no_accept_header(client): async def test_json_no_accept_header(client): json_input = json.loads('{"source":"foo"}') await client.analyze_body_no_accept_header(input=json_input) + +@pytest.mark.asyncio +async def test_binary_body_two_content_types(client): + json_input = {"hello":"world"} + await client.binary_body_with_two_content_types(json_input, content_type="application/json") + + content = b"hello, world" + await client.binary_body_with_two_content_types(content, content_type="application/octet-stream") diff --git a/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py b/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py index 03b15321a2c..ba984b753b4 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/test_media_types.py @@ -56,3 +56,10 @@ def test_pdf_no_accept_header(client): def test_json_no_accept_header(client): json_input = json.loads('{"source":"foo"}') client.analyze_body_no_accept_header(input=json_input) + +def test_binary_body_two_content_types(client): + json_input = {"hello":"world"} + client.binary_body_with_two_content_types(json_input, content_type="application/json") + + content = b"hello, world" + client.binary_body_with_two_content_types(content, content_type="application/octet-stream") From c8cc519b5442d638093b6abeb237a1a53d55e262 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 2 Nov 2021 11:20:20 -0700 Subject: [PATCH 10/23] don't do json kwarg for io bodies for legacy --- autorest/codegen/models/request_builder_parameter_list.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/autorest/codegen/models/request_builder_parameter_list.py b/autorest/codegen/models/request_builder_parameter_list.py index 9371a1864f8..207c8ce97bd 100644 --- a/autorest/codegen/models/request_builder_parameter_list.py +++ b/autorest/codegen/models/request_builder_parameter_list.py @@ -8,7 +8,7 @@ from typing import List, Optional, TypeVar, Dict from .request_builder_parameter import RequestBuilderParameter from .parameter_list import ParameterList -from .parameter import ParameterLocation, Parameter +from .parameter import ParameterLocation, Parameter, ParameterStyle from .primitive_schemas import AnySchema from .dictionary_schema import DictionarySchema from .base_schema import BaseSchema @@ -45,6 +45,12 @@ def _change_body_param_name(self, parameter: Parameter, name: str) -> None: def _is_json(self, body_method_param: Parameter) -> bool: if 'json' in body_method_param.serialization_formats: return True + if not any( + flag for flag in ["version_tolerant", "low_level_client"] + if self.code_model.options.get(flag) + ): + if body_method_param.style == ParameterStyle.binary: + return False if any( sr for sr in self.schema_requests if sr.yaml_data.get("protocol", {}).get('http', {}).get('knownMediaType') == "json" From b8e85f5f16ca78f2c9b2819fd13a5d4361cc4507 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 2 Nov 2021 11:34:14 -0700 Subject: [PATCH 11/23] add partial constant body for urlencoded test --- .../AcceptanceTests/asynctests/test_urlencoded.py | 4 ++++ .../vanilla/legacy/AcceptanceTests/test_urlencoded.py | 3 +++ .../aio/operations/_formdataurlencoded_operations.py | 3 ++- .../operations/_formdataurlencoded_operations.py | 3 ++- .../AcceptanceTests/asynctests/test_urlencoded.py | 11 +++++++++++ .../low-level/AcceptanceTests/test_urlencoded.py | 10 ++++++++++ .../rest/formdataurlencoded/_request_builders.py | 3 ++- .../rest/formdataurlencoded/_request_builders_py3.py | 3 ++- .../AcceptanceTests/asynctests/test_urlencoded.py | 8 ++++++++ .../AcceptanceTests/test_urlencoded.py | 7 +++++++ .../aio/operations/_operations.py | 3 ++- .../operations/_operations.py | 3 ++- 12 files changed, 55 insertions(+), 6 deletions(-) diff --git a/test/vanilla/legacy/AcceptanceTests/asynctests/test_urlencoded.py b/test/vanilla/legacy/AcceptanceTests/asynctests/test_urlencoded.py index 046ef770f10..6c559b241bf 100644 --- a/test/vanilla/legacy/AcceptanceTests/asynctests/test_urlencoded.py +++ b/test/vanilla/legacy/AcceptanceTests/asynctests/test_urlencoded.py @@ -42,3 +42,7 @@ async def test_update_pet_with_form(client): pet_age=42, name="Fido", ) + +@pytest.mark.asyncio +async def test_partial_constant_body(client): + await client.formdataurlencoded.partial_constant_body(access_token="foo", service="bar") diff --git a/test/vanilla/legacy/AcceptanceTests/test_urlencoded.py b/test/vanilla/legacy/AcceptanceTests/test_urlencoded.py index 008883b1550..e1cd65efe35 100644 --- a/test/vanilla/legacy/AcceptanceTests/test_urlencoded.py +++ b/test/vanilla/legacy/AcceptanceTests/test_urlencoded.py @@ -41,3 +41,6 @@ def test_update_pet_with_form(client): pet_age=42, name="Fido", ) + +def test_partial_constant_body(client): + client.formdataurlencoded.partial_constant_body(access_token="foo", service="bar") diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py index 0921191358f..be69ca17a88 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py @@ -124,7 +124,8 @@ async def update_pet_with_form( @distributed_trace_async async def partial_constant_body(self, service: str, access_token: str, **kwargs: Any) -> None: - """Test a partially constant formdata body. + """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: + 'foo', service: 'bar' } to pass the test. :param service: Indicates the name of your Azure container registry. :type service: str diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py index 1b58d01c4d7..0c1ae142161 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py @@ -184,7 +184,8 @@ def partial_constant_body( **kwargs # type: Any ): # type: (...) -> None - """Test a partially constant formdata body. + """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: + 'foo', service: 'bar' } to pass the test. :param service: Indicates the name of your Azure container registry. :type service: str diff --git a/test/vanilla/low-level/AcceptanceTests/asynctests/test_urlencoded.py b/test/vanilla/low-level/AcceptanceTests/asynctests/test_urlencoded.py index 801203ccc91..3cdc6151fd1 100644 --- a/test/vanilla/low-level/AcceptanceTests/asynctests/test_urlencoded.py +++ b/test/vanilla/low-level/AcceptanceTests/asynctests/test_urlencoded.py @@ -51,3 +51,14 @@ async def test_update_pet_with_form(send_request): } ) await send_request(request) + +@pytest.mark.asyncio +async def test_partial_constant_body(send_request): + request = formdataurlencoded.build_partial_constant_body_request( + data={ + "access_token": "foo", + "grant_type": "access_token", + "service": "bar" + } + ) + await send_request(request) diff --git a/test/vanilla/low-level/AcceptanceTests/test_urlencoded.py b/test/vanilla/low-level/AcceptanceTests/test_urlencoded.py index a88f785c3c8..430b0381eb0 100644 --- a/test/vanilla/low-level/AcceptanceTests/test_urlencoded.py +++ b/test/vanilla/low-level/AcceptanceTests/test_urlencoded.py @@ -50,3 +50,13 @@ def test_update_pet_with_form(send_request): } ) send_request(request) + +def test_partial_constant_body(send_request): + request = formdataurlencoded.build_partial_constant_body_request( + data={ + "access_token": "foo", + "grant_type": "access_token", + "service": "bar" + } + ) + send_request(request) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py index 2ee4ad4087e..74ec1c95648 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py @@ -85,7 +85,8 @@ def build_partial_constant_body_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - """Test a partially constant formdata body. + """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: + 'foo', service: 'bar' } to pass the test. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py index 7a631ddbd83..e070852dfba 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py @@ -72,7 +72,8 @@ def build_update_pet_with_form_request( def build_partial_constant_body_request( *, data: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - """Test a partially constant formdata body. + """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: + 'foo', service: 'bar' } to pass the test. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. diff --git a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_urlencoded.py b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_urlencoded.py index e80bfc536e7..dc79f0d8cbc 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_urlencoded.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_urlencoded.py @@ -43,3 +43,11 @@ async def test_update_pet_with_form(client): "name": "Fido", } ) + +@pytest.mark.asyncio +async def test_partial_constant_body(client): + await client.formdataurlencoded.partial_constant_body({ + "access_token": "foo", + "grant_type": "access_token", + "service": "bar" + }) diff --git a/test/vanilla/version-tolerant/AcceptanceTests/test_urlencoded.py b/test/vanilla/version-tolerant/AcceptanceTests/test_urlencoded.py index fed9c247c85..9cc7e7340be 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/test_urlencoded.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/test_urlencoded.py @@ -42,3 +42,10 @@ def test_update_pet_with_form(client): "name": "Fido", } ) + +def test_partial_constant_body(client): + client.formdataurlencoded.partial_constant_body({ + "access_token": "foo", + "grant_type": "access_token", + "service": "bar" + }) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py index 23bf3989133..4a633e13d7e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py @@ -103,7 +103,8 @@ async def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs @distributed_trace_async async def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> None: - """Test a partially constant formdata body. + """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: + 'foo', service: 'bar' } to pass the test. :param data: Form-encoded input for data. See the template in our example to find the input shape. diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py index e9d0743805a..8c54bfc4842 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py @@ -168,7 +168,8 @@ def partial_constant_body( **kwargs # type: Any ): # type: (...) -> None - """Test a partially constant formdata body. + """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: + 'foo', service: 'bar' } to pass the test. :param data: Form-encoded input for data. See the template in our example to find the input shape. From ceceead274bfeaba3835201125f7eb35be16cd4c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 2 Nov 2021 11:46:40 -0700 Subject: [PATCH 12/23] regenerate --- .../_xms_error_response_extensions.py | 4 ++-- .../aio/_xms_error_response_extensions.py | 4 ++-- .../_xms_error_response_extensions.py | 4 ++-- .../aio/_xms_error_response_extensions.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py index cad6c221f24..4f8ace80f36 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py @@ -24,7 +24,7 @@ class XMSErrorResponseExtensions(object): """XMS Error Response Extensions. - :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. + :keyword endpoint: Service URL. Default value is 'http://localhost'. :paramtype endpoint: str """ @@ -32,7 +32,7 @@ def __init__( self, **kwargs # type: Any ): # type: (...) -> None - endpoint = kwargs.pop("endpoint", "http://localhost:3000") # type: str + endpoint = kwargs.pop("endpoint", "http://localhost") # type: str self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py index 186346173a7..fe0af85886a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py @@ -23,11 +23,11 @@ class XMSErrorResponseExtensions: """XMS Error Response Extensions. - :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. + :keyword endpoint: Service URL. Default value is 'http://localhost'. :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__(self, *, endpoint: str = "http://localhost", **kwargs: Any) -> None: self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py index 66c4c3b2438..8c538d15b61 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py @@ -27,7 +27,7 @@ class XMSErrorResponseExtensions(object): :ivar pet: PetOperations operations :vartype pet: xmserrorresponseversiontolerant.operations.PetOperations - :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. + :keyword endpoint: Service URL. Default value is 'http://localhost'. :paramtype endpoint: str """ @@ -35,7 +35,7 @@ def __init__( self, **kwargs # type: Any ): # type: (...) -> None - endpoint = kwargs.pop("endpoint", "http://localhost:3000") # type: str + endpoint = kwargs.pop("endpoint", "http://localhost") # type: str self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py index c5d43703b4b..1bdc468fa0d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py @@ -26,11 +26,11 @@ class XMSErrorResponseExtensions: :ivar pet: PetOperations operations :vartype pet: xmserrorresponseversiontolerant.aio.operations.PetOperations - :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. + :keyword endpoint: Service URL. Default value is 'http://localhost'. :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__(self, *, endpoint: str = "http://localhost", **kwargs: Any) -> None: self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) From a952b0672a922896031c63032a00171f1ec1e3fb Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 2 Nov 2021 12:28:57 -0700 Subject: [PATCH 13/23] circle through all body kwargs --- .../models/request_builder_parameter_list.py | 186 +++++++++++------- .../aio/operations/_upload_operations.py | 4 +- .../operations/_upload_operations.py | 4 +- .../_media_types_client_operations.py | 26 +-- .../_media_types_client_operations.py | 26 +-- .../_xms_error_response_extensions.py | 4 +- .../aio/_xms_error_response_extensions.py | 4 +- 7 files changed, 124 insertions(+), 130 deletions(-) diff --git a/autorest/codegen/models/request_builder_parameter_list.py b/autorest/codegen/models/request_builder_parameter_list.py index 207c8ce97bd..4a5504560f6 100644 --- a/autorest/codegen/models/request_builder_parameter_list.py +++ b/autorest/codegen/models/request_builder_parameter_list.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- import re from copy import copy -from typing import List, Optional, TypeVar, Dict +from typing import List, Optional, Tuple, TypeVar, Dict from .request_builder_parameter import RequestBuilderParameter from .parameter_list import ParameterList from .parameter import ParameterLocation, Parameter, ParameterStyle @@ -25,6 +25,9 @@ def _update_content_types(content_types_to_assign: List[str], param: Parameter): c for c in content_types_to_assign if c not in param.content_types ] +def _kwarg_not_added(body_method_params, serialized_name: str) -> bool: + return not any(b for b in body_method_params if b.serialized_name == serialized_name) + class RequestBuilderParameterList(ParameterList): def __init__( self, @@ -80,90 +83,125 @@ def _update_constant_params(self): else: constant_body.serialized_name = "content" + def _add_files_kwarg( + self, content_types_to_assign, body_method_param + ) -> Tuple[List[str], RequestBuilderParameter]: + file_kwarg = copy(body_method_param) + self._change_body_param_name(file_kwarg, "files") + file_kwarg.schema = DictionarySchema( + namespace="", + yaml_data={}, + element_type=AnySchema(namespace="", yaml_data={}), + ) + file_kwarg.description = ( + "Multipart input for files. See the template in our example to find the input shape. " + + file_kwarg.description + ) + file_kwarg.is_multipart = False + file_kwarg.content_types = [ + c for c in content_types_to_assign + if c == "multipart/form-data" + ] + content_types_to_assign = _update_content_types(content_types_to_assign, file_kwarg) + return content_types_to_assign, file_kwarg + + def _add_data_kwarg( + self, content_types_to_assign, body_method_param + ) -> Tuple[List[str], RequestBuilderParameter]: + data_kwarg = copy(body_method_param) + self._change_body_param_name(data_kwarg, "data") + data_kwarg.schema = DictionarySchema( + namespace="", + yaml_data={}, + element_type=AnySchema(namespace="", yaml_data={}), + ) + data_kwarg.description = ( + "Pass in dictionary that contains form data to include in the body of the request. " + + data_kwarg.description + ) + data_kwarg.is_data_input = False + data_kwarg.content_types = [ + c for c in content_types_to_assign + if c == "application/x-www-form-urlencoded" + ] + content_types_to_assign = _update_content_types(content_types_to_assign, data_kwarg) + return content_types_to_assign, data_kwarg + + def _add_json_kwarg( + self, content_types_to_assign, body_method_param + ) -> Tuple[List[str], RequestBuilderParameter]: + json_kwarg = copy(body_method_param) + self._change_body_param_name(json_kwarg, "json") + json_kwarg.description = ( + "Pass in a JSON-serializable object (usually a dictionary). " + "See the template in our example to find the input shape. " + + json_kwarg.description + ) + json_kwarg.schema = AnySchema(namespace="", yaml_data={}) + json_kwarg.content_types = [ + c for c in content_types_to_assign + if _JSON_REGEXP.match(c) + ] + content_types_to_assign = _update_content_types(content_types_to_assign, json_kwarg) + return content_types_to_assign, json_kwarg + + def _add_content_kwarg( + self, content_types_to_assign, body_method_param + ) -> RequestBuilderParameter: + content_kwarg = copy(body_method_param) + self._change_body_param_name(content_kwarg, "content") + content_kwarg.schema = AnySchema(namespace="", yaml_data={}) + content_kwarg.description = ( + "Pass in binary content you want in the body of the request (typically bytes, " + "a byte iterator, or stream input). " + + content_kwarg.description + ) + content_kwarg.is_data_input = False + content_kwarg.is_multipart = False + content_kwarg.content_types = content_types_to_assign + return content_kwarg + def add_body_kwargs(self) -> None: self._update_constant_params() - try: - body_kwargs_added = [] - body_method_param = next( - p for p in self.parameters - if p.location == ParameterLocation.Body and not p.constant - ) - except StopIteration: - pass - else: - content_types_to_assign = copy(self.content_types) - if body_method_param.is_multipart: - file_kwarg = copy(body_method_param) - self._change_body_param_name(file_kwarg, "files") - file_kwarg.schema = DictionarySchema( - namespace="", - yaml_data={}, - element_type=AnySchema(namespace="", yaml_data={}), - ) - file_kwarg.description = ( - "Multipart input for files. See the template in our example to find the input shape. " + - file_kwarg.description + body_kwargs_added: List[RequestBuilderParameter] = [] + body_method_params = [ + p for p in self.parameters + if p.location == ParameterLocation.Body and not p.constant + ] + if not body_method_params: + return + content_types_to_assign = copy(self.content_types) + for body_method_param in body_method_params: + if body_method_param.is_multipart and _kwarg_not_added(body_kwargs_added, "files"): + content_types_to_assign, file_kwarg = self._add_files_kwarg( + content_types_to_assign, body_method_param ) - file_kwarg.is_multipart = False - file_kwarg.content_types = [ - c for c in content_types_to_assign - if c == "multipart/form-data" - ] - content_types_to_assign = _update_content_types(content_types_to_assign, file_kwarg) body_kwargs_added.append(file_kwarg) - if body_method_param.is_data_input: - data_kwarg = copy(body_method_param) - self._change_body_param_name(data_kwarg, "data") - data_kwarg.schema = DictionarySchema( - namespace="", - yaml_data={}, - element_type=AnySchema(namespace="", yaml_data={}), - ) - data_kwarg.description = ( - "Pass in dictionary that contains form data to include in the body of the request. " + - data_kwarg.description + + elif body_method_param.is_data_input and _kwarg_not_added(body_kwargs_added, "data"): + content_types_to_assign, data_kwarg = self._add_data_kwarg( + content_types_to_assign, body_method_param ) - data_kwarg.is_data_input = False - data_kwarg.content_types = [ - c for c in content_types_to_assign - if c == "application/x-www-form-urlencoded" - ] - content_types_to_assign = _update_content_types(content_types_to_assign, data_kwarg) body_kwargs_added.append(data_kwarg) - if self._is_json(body_method_param): - json_kwarg = copy(body_method_param) - self._change_body_param_name(json_kwarg, "json") - json_kwarg.description = ( - "Pass in a JSON-serializable object (usually a dictionary). " - "See the template in our example to find the input shape. " + - json_kwarg.description + elif self._is_json(body_method_param) and _kwarg_not_added(body_kwargs_added, "json"): + content_types_to_assign, json_kwarg = self._add_json_kwarg( + content_types_to_assign, body_method_param ) - json_kwarg.schema = AnySchema(namespace="", yaml_data={}) - json_kwarg.content_types = [ - c for c in content_types_to_assign - if _JSON_REGEXP.match(c) - ] - content_types_to_assign = _update_content_types(content_types_to_assign, json_kwarg) body_kwargs_added.append(json_kwarg) - content_kwarg = copy(body_method_param) - self._change_body_param_name(content_kwarg, "content") - content_kwarg.schema = AnySchema(namespace="", yaml_data={}) - content_kwarg.description = ( - "Pass in binary content you want in the body of the request (typically bytes, " - "a byte iterator, or stream input). " + - content_kwarg.description + first_body_param = body_method_params[0] + if _kwarg_not_added(body_kwargs_added, "content"): + # we always add a content kwarg so users can pass in input by stream + content_kwarg = self._add_content_kwarg( + content_types_to_assign, first_body_param ) - content_kwarg.is_data_input = False - content_kwarg.is_multipart = False - content_kwarg.content_types = content_types_to_assign body_kwargs_added.append(content_kwarg) - if len(body_kwargs_added) == 1: - body_kwargs_added[0].required = body_method_param.required - else: - for kwarg in body_kwargs_added: - kwarg.required = False - self.parameters = body_kwargs_added + self.parameters + if len(body_kwargs_added) == 1: + body_kwargs_added[0].required = first_body_param.required + else: + for kwarg in body_kwargs_added: + kwarg.required = False + self.parameters = body_kwargs_added + self.parameters @property def json_body(self) -> BaseSchema: diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py index 84fa7d53b80..8377fe3daec 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py @@ -63,11 +63,11 @@ async def file(self, file_param: IO, **kwargs: Any) -> None: content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - json = file_param + content = file_param request = build_file_request( content_type=content_type, - json=json, + content=content, template_url=self.file.metadata["url"], ) request = _convert_request(request) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py index 0324ad0b73d..fa9f2a4e0f6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py @@ -118,11 +118,11 @@ def file( content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - json = file_param + content = file_param request = build_file_request( content_type=content_type, - json=json, + content=content, template_url=self.file.metadata["url"], ) request = _convert_request(request) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py index 19e49f2361a..cd355e6c422 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py @@ -217,21 +217,10 @@ async def binary_body_with_two_content_types(self, message: IO, **kwargs: Any) - content_type = kwargs.pop("content_type", None) # type: Optional[Union[str, "_models.ContentType1"]] - json = None - content = None - if content_type.split(";")[0] in ["application/json"]: - json = message - elif content_type.split(";")[0] in ["application/octet-stream"]: - content = message - else: - raise ValueError( - "The content_type '{}' is not one of the allowed values: " - "['application/json', 'application/octet-stream']".format(content_type) - ) + content = message request = build_binary_body_with_two_content_types_request( content_type=content_type, - json=json, content=content, template_url=self.binary_body_with_two_content_types.metadata["url"], ) @@ -276,21 +265,10 @@ async def binary_body_with_three_content_types(self, message: Union[IO, str], ** content_type = kwargs.pop("content_type", "text/plain") # type: Optional[Union[str, "_models.ContentType1"]] - json = None - content = None - if content_type.split(";")[0] in ["application/json"]: - json = message - elif content_type.split(";")[0] in ["application/octet-stream", "text/plain"]: - content = message - else: - raise ValueError( - "The content_type '{}' is not one of the allowed values: " - "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) - ) + content = message request = build_binary_body_with_three_content_types_request( content_type=content_type, - json=json, content=content, template_url=self.binary_body_with_three_content_types.metadata["url"], ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py index e0b19ccae6d..f949c757a6a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py @@ -376,21 +376,10 @@ def binary_body_with_two_content_types( content_type = kwargs.pop("content_type", None) # type: Optional[Union[str, "_models.ContentType1"]] - json = None - content = None - if content_type.split(";")[0] in ["application/json"]: - json = message - elif content_type.split(";")[0] in ["application/octet-stream"]: - content = message - else: - raise ValueError( - "The content_type '{}' is not one of the allowed values: " - "['application/json', 'application/octet-stream']".format(content_type) - ) + content = message request = build_binary_body_with_two_content_types_request( content_type=content_type, - json=json, content=content, template_url=self.binary_body_with_two_content_types.metadata["url"], ) @@ -440,21 +429,10 @@ def binary_body_with_three_content_types( content_type = kwargs.pop("content_type", "text/plain") # type: Optional[Union[str, "_models.ContentType1"]] - json = None - content = None - if content_type.split(";")[0] in ["application/json"]: - json = message - elif content_type.split(";")[0] in ["application/octet-stream", "text/plain"]: - content = message - else: - raise ValueError( - "The content_type '{}' is not one of the allowed values: " - "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) - ) + content = message request = build_binary_body_with_three_content_types_request( content_type=content_type, - json=json, content=content, template_url=self.binary_body_with_three_content_types.metadata["url"], ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py index 887988a9327..c0a906782e3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py @@ -28,13 +28,13 @@ class XMSErrorResponseExtensions(object): :ivar pet: PetOperations operations :vartype pet: xmserrorresponse.operations.PetOperations - :param base_url: Service URL. Default value is 'http://localhost:3000'. + :param base_url: Service URL. Default value is 'http://localhost'. :type base_url: str """ def __init__( self, - base_url="http://localhost:3000", # type: str + base_url="http://localhost", # type: str **kwargs # type: Any ): # type: (...) -> None diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py index 97a74a4b5e4..732811412f6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py @@ -23,11 +23,11 @@ class XMSErrorResponseExtensions: :ivar pet: PetOperations operations :vartype pet: xmserrorresponse.aio.operations.PetOperations - :param base_url: Service URL. Default value is 'http://localhost:3000'. + :param base_url: Service URL. Default value is 'http://localhost'. :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__(self, base_url: str = "http://localhost", **kwargs: Any) -> None: self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) From 108e3894d0b96b5ba3a6ec91b67f3aff948bcf87 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 2 Nov 2021 15:11:38 -0700 Subject: [PATCH 14/23] update xms test generation --- .../xmserrorresponse/_xms_error_response_extensions.py | 4 ++-- .../xmserrorresponse/aio/_xms_error_response_extensions.py | 4 ++-- .../_xms_error_response_extensions.py | 4 ++-- .../aio/_xms_error_response_extensions.py | 4 ++-- .../_xms_error_response_extensions.py | 4 ++-- .../aio/_xms_error_response_extensions.py | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py index c0a906782e3..887988a9327 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py @@ -28,13 +28,13 @@ class XMSErrorResponseExtensions(object): :ivar pet: PetOperations operations :vartype pet: xmserrorresponse.operations.PetOperations - :param base_url: Service URL. Default value is 'http://localhost'. + :param base_url: Service URL. Default value is 'http://localhost:3000'. :type base_url: str """ def __init__( self, - base_url="http://localhost", # type: str + base_url="http://localhost:3000", # type: str **kwargs # type: Any ): # type: (...) -> None diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py index 732811412f6..97a74a4b5e4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py @@ -23,11 +23,11 @@ class XMSErrorResponseExtensions: :ivar pet: PetOperations operations :vartype pet: xmserrorresponse.aio.operations.PetOperations - :param base_url: Service URL. Default value is 'http://localhost'. + :param base_url: Service URL. Default value is 'http://localhost:3000'. :type base_url: str """ - def __init__(self, base_url: str = "http://localhost", **kwargs: Any) -> None: + def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py index 4f8ace80f36..cad6c221f24 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py @@ -24,7 +24,7 @@ class XMSErrorResponseExtensions(object): """XMS Error Response Extensions. - :keyword endpoint: Service URL. Default value is 'http://localhost'. + :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. :paramtype endpoint: str """ @@ -32,7 +32,7 @@ def __init__( self, **kwargs # type: Any ): # type: (...) -> None - endpoint = kwargs.pop("endpoint", "http://localhost") # type: str + endpoint = kwargs.pop("endpoint", "http://localhost:3000") # type: str self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py index fe0af85886a..186346173a7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py @@ -23,11 +23,11 @@ class XMSErrorResponseExtensions: """XMS Error Response Extensions. - :keyword endpoint: Service URL. Default value is 'http://localhost'. + :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost", **kwargs: Any) -> None: + def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py index 8c538d15b61..66c4c3b2438 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py @@ -27,7 +27,7 @@ class XMSErrorResponseExtensions(object): :ivar pet: PetOperations operations :vartype pet: xmserrorresponseversiontolerant.operations.PetOperations - :keyword endpoint: Service URL. Default value is 'http://localhost'. + :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. :paramtype endpoint: str """ @@ -35,7 +35,7 @@ def __init__( self, **kwargs # type: Any ): # type: (...) -> None - endpoint = kwargs.pop("endpoint", "http://localhost") # type: str + endpoint = kwargs.pop("endpoint", "http://localhost:3000") # type: str self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py index 1bdc468fa0d..c5d43703b4b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py @@ -26,11 +26,11 @@ class XMSErrorResponseExtensions: :ivar pet: PetOperations operations :vartype pet: xmserrorresponseversiontolerant.aio.operations.PetOperations - :keyword endpoint: Service URL. Default value is 'http://localhost'. + :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost", **kwargs: Any) -> None: + def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) From 18b4c1731610ab0bcf5d584a2b742c027a4eeeeb Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 3 Nov 2021 14:39:52 -0700 Subject: [PATCH 15/23] add JSONType type definition --- autorest/codegen/models/imports.py | 1 + autorest/codegen/models/object_schema.py | 6 +- autorest/codegen/models/operation.py | 5 + autorest/codegen/models/parameter.py | 3 +- autorest/codegen/models/primitive_schemas.py | 11 + autorest/codegen/models/request_builder.py | 5 + .../models/request_builder_parameter_list.py | 4 +- package.json | 2 +- .../rest/duration/_request_builders.py | 7 +- .../rest/duration/_request_builders_py3.py | 9 +- .../parameter_grouping/_request_builders.py | 7 +- .../_request_builders_py3.py | 9 +- .../lr_os_custom_header/_request_builders.py | 13 +- .../_request_builders_py3.py | 27 +- .../rest/lro_retrys/_request_builders.py | 13 +- .../rest/lro_retrys/_request_builders_py3.py | 23 +- .../rest/lros/_request_builders.py | 55 +- .../rest/lros/_request_builders_py3.py | 127 +-- .../rest/lrosads/_request_builders.py | 41 +- .../rest/lrosads/_request_builders_py3.py | 85 +- .../storage_accounts/_request_builders.py | 13 +- .../storage_accounts/_request_builders_py3.py | 21 +- .../rest/usage/_request_builders.py | 5 +- .../rest/usage/_request_builders_py3.py | 5 +- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 109 +-- .../operations/_operations.py | 109 +-- .../aio/operations/_operations.py | 13 +- .../operations/_operations.py | 13 +- .../aio/operations/_operations.py | 695 ++++++++-------- .../operations/_operations.py | 777 +++++++++--------- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 109 +-- .../operations/_operations.py | 109 +-- .../aio/operations/_operations.py | 75 +- .../operations/_operations.py | 77 +- .../aio/operations/_operations.py | 7 +- .../operations/_operations.py | 7 +- .../rest/params/_request_builders.py | 7 +- .../rest/params/_request_builders_py3.py | 9 +- .../rest/params/_request_builders.py | 7 +- .../rest/params/_request_builders_py3.py | 9 +- .../aio/operations/_operations.py | 5 +- .../operations/_operations.py | 5 +- .../aio/operations/_operations.py | 5 +- .../operations/_operations.py | 5 +- .../operations/_array_operations_py3.py | 39 +- .../operations/_array_operations_py3.py | 5 +- .../operations/_basic_operations_py3.py | 3 +- .../operations/_dictionary_operations_py3.py | 5 +- .../operations/_inheritance_operations_py3.py | 3 +- .../_polymorphicrecursive_operations_py3.py | 3 +- .../_polymorphism_operations_py3.py | 13 +- .../operations/_primitive_operations_py3.py | 23 +- .../_readonlyproperty_operations_py3.py | 3 +- .../rest/pets/_request_builders.py | 17 +- .../rest/pets/_request_builders_py3.py | 29 +- .../rest/_request_builders.py | 11 +- .../rest/_request_builders_py3.py | 17 +- .../rest/array/_request_builders.py | 41 +- .../rest/array/_request_builders_py3.py | 79 +- .../rest/upload/_request_builders.py | 7 +- .../rest/upload/_request_builders_py3.py | 9 +- .../rest/bool/_request_builders.py | 5 +- .../rest/bool/_request_builders_py3.py | 5 +- .../rest/byte/_request_builders.py | 7 +- .../rest/byte/_request_builders_py3.py | 9 +- .../rest/array/_request_builders.py | 9 +- .../rest/array/_request_builders_py3.py | 13 +- .../rest/basic/_request_builders.py | 7 +- .../rest/basic/_request_builders_py3.py | 9 +- .../rest/dictionary/_request_builders.py | 9 +- .../rest/dictionary/_request_builders_py3.py | 13 +- .../rest/flattencomplex/_request_builders.py | 5 +- .../flattencomplex/_request_builders_py3.py | 5 +- .../rest/inheritance/_request_builders.py | 7 +- .../rest/inheritance/_request_builders_py3.py | 9 +- .../polymorphicrecursive/_request_builders.py | 7 +- .../_request_builders_py3.py | 9 +- .../rest/polymorphism/_request_builders.py | 13 +- .../polymorphism/_request_builders_py3.py | 25 +- .../rest/primitive/_request_builders.py | 27 +- .../rest/primitive/_request_builders_py3.py | 49 +- .../readonlyproperty/_request_builders.py | 7 +- .../readonlyproperty/_request_builders_py3.py | 9 +- .../rest/date/_request_builders.py | 9 +- .../rest/date/_request_builders_py3.py | 13 +- .../rest/datetime/_request_builders.py | 19 +- .../rest/datetime/_request_builders_py3.py | 35 +- .../rest/datetimerfc1123/_request_builders.py | 9 +- .../datetimerfc1123/_request_builders_py3.py | 13 +- .../rest/dictionary/_request_builders.py | 35 +- .../rest/dictionary/_request_builders_py3.py | 67 +- .../rest/duration/_request_builders.py | 7 +- .../rest/duration/_request_builders_py3.py | 9 +- .../rest/formdata/_request_builders.py | 5 +- .../rest/formdata/_request_builders_py3.py | 5 +- .../formdataurlencoded/_request_builders.py | 5 +- .../_request_builders_py3.py | 5 +- .../rest/int/_request_builders.py | 15 +- .../rest/int/_request_builders_py3.py | 25 +- .../rest/number/_request_builders.py | 17 +- .../rest/number/_request_builders_py3.py | 29 +- .../rest/enum/_request_builders.py | 11 +- .../rest/enum/_request_builders_py3.py | 17 +- .../rest/string/_request_builders.py | 9 +- .../rest/string/_request_builders_py3.py | 13 +- .../rest/time/_request_builders.py | 7 +- .../rest/time/_request_builders_py3.py | 9 +- .../rest/pet/_request_builders.py | 7 +- .../rest/pet/_request_builders_py3.py | 9 +- .../http_client_failure/_request_builders.py | 31 +- .../_request_builders_py3.py | 57 +- .../rest/http_failure/_request_builders.py | 5 +- .../http_failure/_request_builders_py3.py | 5 +- .../rest/http_redirects/_request_builders.py | 19 +- .../http_redirects/_request_builders_py3.py | 33 +- .../rest/http_retry/_request_builders.py | 17 +- .../rest/http_retry/_request_builders_py3.py | 29 +- .../http_server_failure/_request_builders.py | 9 +- .../_request_builders_py3.py | 13 +- .../rest/http_success/_request_builders.py | 33 +- .../http_success/_request_builders_py3.py | 61 +- .../multiple_responses/_request_builders.py | 5 +- .../_request_builders_py3.py | 5 +- .../rest/_request_builders.py | 15 +- .../rest/_request_builders_py3.py | 27 +- .../rest/_request_builders.py | 19 +- .../rest/_request_builders_py3.py | 35 +- .../rest/_request_builders.py | 15 +- .../rest/_request_builders_py3.py | 25 +- .../rest/float/_request_builders.py | 7 +- .../rest/float/_request_builders_py3.py | 9 +- .../rest/int/_request_builders.py | 7 +- .../rest/int/_request_builders_py3.py | 9 +- .../rest/_request_builders.py | 7 +- .../rest/_request_builders_py3.py | 9 +- .../availability_sets/_request_builders.py | 7 +- .../_request_builders_py3.py | 9 +- .../rest/explicit/_request_builders.py | 37 +- .../rest/explicit/_request_builders_py3.py | 89 +- .../rest/implicit/_request_builders.py | 7 +- .../rest/implicit/_request_builders_py3.py | 9 +- .../rest/_request_builders.py | 9 +- .../rest/_request_builders_py3.py | 21 +- .../rest/xml/_request_builders.py | 7 +- .../rest/xml/_request_builders_py3.py | 9 +- .../aio/operations/_operations.py | 49 +- .../operations/_operations.py | 61 +- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 35 +- .../operations/_operations.py | 35 +- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 289 +++---- .../operations/_operations_py3.py | 339 ++++---- .../aio/operations/_operations.py | 289 +++---- .../operations/_operations.py | 291 +++---- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 35 +- .../operations/_operations.py | 35 +- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 11 +- .../operations/_operations.py | 11 +- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 15 +- .../operations/_operations.py | 17 +- .../aio/operations/_operations.py | 127 +-- .../operations/_operations.py | 127 +-- .../aio/operations/_operations.py | 9 +- .../operations/_operations.py | 9 +- .../aio/operations/_operations.py | 67 +- .../operations/_operations.py | 71 +- .../aio/operations/_operations.py | 51 +- .../operations/_operations.py | 51 +- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 5 +- .../operations/_operations.py | 5 +- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 41 +- .../operations/_operations.py | 41 +- .../aio/operations/_operations.py | 1 + .../operations/_operations.py | 1 + .../aio/operations/_operations.py | 25 +- .../operations/_operations.py | 27 +- .../aio/operations/_operations.py | 169 ++-- .../operations/_operations.py | 169 ++-- .../aio/operations/_operations.py | 13 +- .../operations/_operations.py | 13 +- 221 files changed, 3756 insertions(+), 3148 deletions(-) diff --git a/autorest/codegen/models/imports.py b/autorest/codegen/models/imports.py index 3452eab08be..9874674c9af 100644 --- a/autorest/codegen/models/imports.py +++ b/autorest/codegen/models/imports.py @@ -95,3 +95,4 @@ def merge(self, file_import: "FileImport") -> None: for package_name, module_list in package_list.items(): for module_name in module_list: self._add_import(package_name, import_type, module_name, typing_section) + self.type_definitions.update(file_import.type_definitions) diff --git a/autorest/codegen/models/object_schema.py b/autorest/codegen/models/object_schema.py index 23f872df895..24e74c982dc 100644 --- a/autorest/codegen/models/object_schema.py +++ b/autorest/codegen/models/object_schema.py @@ -224,15 +224,15 @@ def serialization_type(self) -> str: @property def type_annotation(self) -> str: - return "Any" + return "JSONType" @property def operation_type_annotation(self) -> str: - return "Any" + return "JSONType" @property def docstring_type(self) -> str: - return "Any" + return "JSONType" @property def docstring_text(self) -> str: diff --git a/autorest/codegen/models/operation.py b/autorest/codegen/models/operation.py index a7349b95491..ddd8394a6e4 100644 --- a/autorest/codegen/models/operation.py +++ b/autorest/codegen/models/operation.py @@ -221,6 +221,11 @@ def imports(self, async_mode: bool) -> FileImport: file_import.add_from_import( f"{relative_path}_vendor", "_convert_request", ImportType.LOCAL ) + if self.code_model.options["version_tolerant"] and ( + self.parameters.has_body or + any(r for r in self.responses if r.has_body) + ): + file_import.define_mypy_type("JSONType", "Any") return file_import def convert_multiple_content_type_parameters(self) -> None: diff --git a/autorest/codegen/models/parameter.py b/autorest/codegen/models/parameter.py index 4ff43cc996c..c314a508ad4 100644 --- a/autorest/codegen/models/parameter.py +++ b/autorest/codegen/models/parameter.py @@ -209,7 +209,8 @@ def implementation(self) -> str: def _default_value(self) -> Tuple[Optional[Any], str, str]: type_annot = self.multiple_content_types_type_annot or self.schema.operation_type_annotation - if not self.required and not type_annot == "Any": + any_types = ["Any", "JSONType"] + if not self.required and type_annot not in any_types: type_annot = f"Optional[{type_annot}]" if self.client_default_value is not None: diff --git a/autorest/codegen/models/primitive_schemas.py b/autorest/codegen/models/primitive_schemas.py index 1d5d8c5dcc7..0d533bcd3a9 100644 --- a/autorest/codegen/models/primitive_schemas.py +++ b/autorest/codegen/models/primitive_schemas.py @@ -141,6 +141,17 @@ def imports(self) -> FileImport: file_import.add_from_import("typing", "Any", ImportType.STDLIB, TypingSection.CONDITIONAL) return file_import +class JSONSchema(AnySchema): + + @property + def docstring_type(self) -> str: + return "JSONType" + + @property + def type_annotation(self) -> str: + return "JSONType" + + class NumberSchema(PrimitiveSchema): def __init__(self, namespace: str, yaml_data: Dict[str, Any]) -> None: super(NumberSchema, self).__init__(namespace=namespace, yaml_data=yaml_data) diff --git a/autorest/codegen/models/request_builder.py b/autorest/codegen/models/request_builder.py index a25f8e178d1..b4a46b4de0f 100644 --- a/autorest/codegen/models/request_builder.py +++ b/autorest/codegen/models/request_builder.py @@ -84,6 +84,11 @@ def imports(self) -> FileImport: "typing", "Any", ImportType.STDLIB, typing_section=TypingSection.CONDITIONAL ) file_import.add_from_import("msrest", "Serializer", ImportType.AZURECORE) + if self.parameters.has_body and ( + self.code_model.options["builders_visibility"] != "embedded" or + self.code_model.options["add_python_3_operation_files"] + ): + file_import.define_mypy_type("JSONType", "Any") return file_import @classmethod diff --git a/autorest/codegen/models/request_builder_parameter_list.py b/autorest/codegen/models/request_builder_parameter_list.py index 4a5504560f6..f4ce109342e 100644 --- a/autorest/codegen/models/request_builder_parameter_list.py +++ b/autorest/codegen/models/request_builder_parameter_list.py @@ -9,7 +9,7 @@ from .request_builder_parameter import RequestBuilderParameter from .parameter_list import ParameterList from .parameter import ParameterLocation, Parameter, ParameterStyle -from .primitive_schemas import AnySchema +from .primitive_schemas import AnySchema, JSONSchema from .dictionary_schema import DictionarySchema from .base_schema import BaseSchema from .schema_request import SchemaRequest @@ -137,7 +137,7 @@ def _add_json_kwarg( "See the template in our example to find the input shape. " + json_kwarg.description ) - json_kwarg.schema = AnySchema(namespace="", yaml_data={}) + json_kwarg.schema = JSONSchema(namespace="", yaml_data={}) json_kwarg.content_types = [ c for c in content_types_to_assign if _JSON_REGEXP.match(c) diff --git a/package.json b/package.json index 0103048815b..ce59c769412 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@azure-tools/extension": "~3.2.1" }, "devDependencies": { - "@microsoft.azure/autorest.testserver": "^3.1.5" + "@microsoft.azure/autorest.testserver": "^3.1.6" }, "files": [ "autorest/**/*.py", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py index 37197f9661c..a68dea956c3 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py @@ -13,7 +13,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -61,7 +64,7 @@ def build_put_positive_duration_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. duration body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). duration body. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py index 5a83c6b9493..89c30611e30 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -37,7 +40,7 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_positive_duration_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_positive_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put a positive duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -45,7 +48,7 @@ def build_put_positive_duration_request(*, json: Any = None, content: Any = None :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. duration body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). duration body. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py index 1828f2419bb..43d4d9eba9b 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -34,7 +37,7 @@ def build_post_required_request( :type path: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py index 73ad6e2051d..3041108d3d4 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py @@ -5,20 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from ..._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() def build_post_required_request( path: str, *, - json: Any = None, + json: JSONType = None, content: Any = None, custom_header: Optional[str] = None, query: Optional[int] = 30, @@ -33,7 +36,7 @@ def build_post_required_request( :type path: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py index 3774cac6d68..ffe3d4dca32 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -32,7 +35,7 @@ def build_put_async_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -109,7 +112,7 @@ def build_put201_creating_succeeded200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -185,7 +188,7 @@ def build_post202_retry200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -247,7 +250,7 @@ def build_post_async_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py index 3158cb27018..5874264cf18 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py @@ -5,15 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_put_async_retry_succeeded_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_async_retry_succeeded_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -24,7 +29,7 @@ def build_put_async_retry_succeeded_request(*, json: Any = None, content: Any = :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -82,7 +87,9 @@ def build_put_async_retry_succeeded_request(*, json: Any = None, content: Any = return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put201_creating_succeeded200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put201_creating_succeeded200_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -93,7 +100,7 @@ def build_put201_creating_succeeded200_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -151,7 +158,7 @@ def build_put201_creating_succeeded200_request(*, json: Any = None, content: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post202_retry200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_retry200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -161,7 +168,7 @@ def build_post202_retry200_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -204,7 +211,9 @@ def build_post202_retry200_request(*, json: Any = None, content: Any = None, **k return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_async_retry_succeeded_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_async_retry_succeeded_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -215,7 +224,7 @@ def build_post_async_retry_succeeded_request(*, json: Any = None, content: Any = :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py index 406467cfe34..09cc95cda24 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -31,7 +34,7 @@ def build_put201_creating_succeeded200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -107,7 +110,7 @@ def build_put_async_relative_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -297,7 +300,7 @@ def build_post202_retry200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -358,7 +361,7 @@ def build_post_async_relative_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py index 68ffe9b6ac0..068e82a170f 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py @@ -5,15 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_put201_creating_succeeded200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put201_creating_succeeded200_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -23,7 +28,7 @@ def build_put201_creating_succeeded200_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -82,7 +87,7 @@ def build_put201_creating_succeeded200_request(*, json: Any = None, content: Any def build_put_async_relative_retry_succeeded_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -93,7 +98,7 @@ def build_put_async_relative_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -242,7 +247,7 @@ def build_delete_async_relative_retry_succeeded_request(**kwargs: Any) -> HttpRe return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) -def build_post202_retry200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_retry200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -251,7 +256,7 @@ def build_post202_retry200_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -295,7 +300,7 @@ def build_post202_retry200_request(*, json: Any = None, content: Any = None, **k def build_post_async_relative_retry_succeeded_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -306,7 +311,7 @@ def build_post_async_relative_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py index 516ba1ef1f7..2b0c04390b9 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -30,7 +33,7 @@ def build_put200_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -105,7 +108,7 @@ def build_patch200_succeeded_ignore_headers_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to patch. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to patch. :paramtype content: any @@ -180,7 +183,7 @@ def build_put201_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -307,7 +310,7 @@ def build_put200_succeeded_no_state_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -383,7 +386,7 @@ def build_put202_retry200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -459,7 +462,7 @@ def build_put201_creating_succeeded200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -535,7 +538,7 @@ def build_put200_updating_succeeded204_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -611,7 +614,7 @@ def build_put201_creating_failed200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -687,7 +690,7 @@ def build_put200_acceptedcanceled200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -762,7 +765,7 @@ def build_put_no_header_in_retry_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -838,7 +841,7 @@ def build_put_async_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -914,7 +917,7 @@ def build_put_async_no_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -990,7 +993,7 @@ def build_put_async_retry_failed_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1066,7 +1069,7 @@ def build_put_async_no_retrycanceled_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1142,7 +1145,7 @@ def build_put_async_no_header_in_retry_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1216,7 +1219,7 @@ def build_put_non_resource_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. sku to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). sku to put. :paramtype content: any @@ -1272,7 +1275,7 @@ def build_put_async_non_resource_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Sku to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Sku to put. :paramtype content: any @@ -1328,7 +1331,7 @@ def build_put_sub_resource_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Sub Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Sub Product to put. :paramtype content: any @@ -1390,7 +1393,7 @@ def build_put_async_sub_resource_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Sub Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Sub Product to put. :paramtype content: any @@ -1970,7 +1973,7 @@ def build_post202_retry200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -2030,7 +2033,7 @@ def build_post202_no_retry204_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -2259,7 +2262,7 @@ def build_post_async_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -2335,7 +2338,7 @@ def build_post_async_no_retry_succeeded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -2411,7 +2414,7 @@ def build_post_async_retry_failed_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -2472,7 +2475,7 @@ def build_post_async_retrycanceled_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py index 60dd861a7e4..bad7d86a58d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py @@ -5,15 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_put200_succeeded_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put200_succeeded_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -22,7 +25,7 @@ def build_put200_succeeded_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -81,7 +84,7 @@ def build_put200_succeeded_request(*, json: Any = None, content: Any = None, **k def build_patch200_succeeded_ignore_headers_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. @@ -91,7 +94,7 @@ def build_patch200_succeeded_ignore_headers_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to patch. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to patch. :paramtype content: any @@ -149,7 +152,7 @@ def build_patch200_succeeded_ignore_headers_request( return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put201_succeeded_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put201_succeeded_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -158,7 +161,7 @@ def build_put201_succeeded_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -260,7 +263,9 @@ def build_post202_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) -def build_put200_succeeded_no_state_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put200_succeeded_no_state_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -269,7 +274,7 @@ def build_put200_succeeded_no_state_request(*, json: Any = None, content: Any = :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -327,7 +332,7 @@ def build_put200_succeeded_no_state_request(*, json: Any = None, content: Any = return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put202_retry200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put202_retry200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. @@ -337,7 +342,7 @@ def build_put202_retry200_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -395,7 +400,9 @@ def build_put202_retry200_request(*, json: Any = None, content: Any = None, **kw return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put201_creating_succeeded200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put201_creating_succeeded200_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -405,7 +412,7 @@ def build_put201_creating_succeeded200_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -463,7 +470,9 @@ def build_put201_creating_succeeded200_request(*, json: Any = None, content: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put200_updating_succeeded204_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put200_updating_succeeded204_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -473,7 +482,7 @@ def build_put200_updating_succeeded204_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -531,7 +540,9 @@ def build_put200_updating_succeeded204_request(*, json: Any = None, content: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put201_creating_failed200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put201_creating_failed200_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -541,7 +552,7 @@ def build_put201_creating_failed200_request(*, json: Any = None, content: Any = :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -599,7 +610,9 @@ def build_put201_creating_failed200_request(*, json: Any = None, content: Any = return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put200_acceptedcanceled200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put200_acceptedcanceled200_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -609,7 +622,7 @@ def build_put200_acceptedcanceled200_request(*, json: Any = None, content: Any = :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -667,7 +680,7 @@ def build_put200_acceptedcanceled200_request(*, json: Any = None, content: Any = return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_no_header_in_retry_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_no_header_in_retry_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -676,7 +689,7 @@ def build_put_no_header_in_retry_request(*, json: Any = None, content: Any = Non :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -734,7 +747,9 @@ def build_put_no_header_in_retry_request(*, json: Any = None, content: Any = Non return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_async_retry_succeeded_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_async_retry_succeeded_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -744,7 +759,7 @@ def build_put_async_retry_succeeded_request(*, json: Any = None, content: Any = :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -802,7 +817,9 @@ def build_put_async_retry_succeeded_request(*, json: Any = None, content: Any = return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_async_no_retry_succeeded_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_async_no_retry_succeeded_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -812,7 +829,7 @@ def build_put_async_no_retry_succeeded_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -870,7 +887,7 @@ def build_put_async_no_retry_succeeded_request(*, json: Any = None, content: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_async_retry_failed_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_async_retry_failed_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -880,7 +897,7 @@ def build_put_async_retry_failed_request(*, json: Any = None, content: Any = Non :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -938,7 +955,9 @@ def build_put_async_retry_failed_request(*, json: Any = None, content: Any = Non return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_async_no_retrycanceled_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_async_no_retrycanceled_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -948,7 +967,7 @@ def build_put_async_no_retrycanceled_request(*, json: Any = None, content: Any = :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1006,7 +1025,9 @@ def build_put_async_no_retrycanceled_request(*, json: Any = None, content: Any = return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_async_no_header_in_retry_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_async_no_header_in_retry_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -1016,7 +1037,7 @@ def build_put_async_no_header_in_retry_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1074,7 +1095,7 @@ def build_put_async_no_header_in_retry_request(*, json: Any = None, content: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_non_resource_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_non_resource_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1082,7 +1103,7 @@ def build_put_non_resource_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. sku to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). sku to put. :paramtype content: any @@ -1122,7 +1143,7 @@ def build_put_non_resource_request(*, json: Any = None, content: Any = None, **k return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_async_non_resource_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_async_non_resource_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1130,7 +1151,7 @@ def build_put_async_non_resource_request(*, json: Any = None, content: Any = Non :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Sku to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Sku to put. :paramtype content: any @@ -1170,7 +1191,7 @@ def build_put_async_non_resource_request(*, json: Any = None, content: Any = Non return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_sub_resource_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_sub_resource_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1178,7 +1199,7 @@ def build_put_sub_resource_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Sub Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Sub Product to put. :paramtype content: any @@ -1224,7 +1245,7 @@ def build_put_sub_resource_request(*, json: Any = None, content: Any = None, **k return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_async_sub_resource_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_async_sub_resource_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1232,7 +1253,7 @@ def build_put_async_sub_resource_request(*, json: Any = None, content: Any = Non :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Sub Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Sub Product to put. :paramtype content: any @@ -1691,7 +1712,7 @@ def build_post200_with_payload_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) -def build_post202_retry200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_retry200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -1700,7 +1721,7 @@ def build_post202_retry200_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1743,7 +1764,7 @@ def build_post202_retry200_request(*, json: Any = None, content: Any = None, **k return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post202_no_retry204_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_no_retry204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -1752,7 +1773,7 @@ def build_post202_no_retry204_request(*, json: Any = None, content: Any = None, :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1939,7 +1960,9 @@ def build_post_double_headers_final_azure_header_get_default_request(**kwargs: A return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) -def build_post_async_retry_succeeded_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_async_retry_succeeded_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1949,7 +1972,7 @@ def build_post_async_retry_succeeded_request(*, json: Any = None, content: Any = :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -2007,7 +2030,9 @@ def build_post_async_retry_succeeded_request(*, json: Any = None, content: Any = return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_async_no_retry_succeeded_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_async_no_retry_succeeded_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2017,7 +2042,7 @@ def build_post_async_no_retry_succeeded_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -2075,7 +2100,7 @@ def build_post_async_no_retry_succeeded_request(*, json: Any = None, content: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_async_retry_failed_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_async_retry_failed_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2085,7 +2110,7 @@ def build_post_async_retry_failed_request(*, json: Any = None, content: Any = No :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -2128,7 +2153,7 @@ def build_post_async_retry_failed_request(*, json: Any = None, content: Any = No return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_async_retrycanceled_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_async_retrycanceled_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2138,7 +2163,7 @@ def build_post_async_retrycanceled_request(*, json: Any = None, content: Any = N :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py index 7e66c168a62..43fb34b8905 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -29,7 +32,7 @@ def build_put_non_retry400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -104,7 +107,7 @@ def build_put_non_retry201_creating400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -179,7 +182,7 @@ def build_put_non_retry201_creating400_invalid_json_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -254,7 +257,7 @@ def build_put_async_relative_retry400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -422,7 +425,7 @@ def build_post_non_retry400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -481,7 +484,7 @@ def build_post202_non_retry400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -541,7 +544,7 @@ def build_post_async_relative_retry400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -600,7 +603,7 @@ def build_put_error201_no_provisioning_state_payload_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -676,7 +679,7 @@ def build_put_async_relative_retry_no_status_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -752,7 +755,7 @@ def build_put_async_relative_retry_no_status_payload_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -890,7 +893,7 @@ def build_post202_no_location_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -951,7 +954,7 @@ def build_post_async_relative_retry_no_payload_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1011,7 +1014,7 @@ def build_put200_invalid_json_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1087,7 +1090,7 @@ def build_put_async_relative_retry_invalid_header_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1163,7 +1166,7 @@ def build_put_async_relative_retry_invalid_json_polling_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1334,7 +1337,7 @@ def build_post202_retry_invalid_header_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1395,7 +1398,7 @@ def build_post_async_relative_retry_invalid_header_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1456,7 +1459,7 @@ def build_post_async_relative_retry_invalid_json_polling_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py index ec1f264865a..e2907322592 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py @@ -5,15 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_put_non_retry400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_non_retry400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request, service returns a 400 to the initial request. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -21,7 +24,7 @@ def build_put_non_retry400_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -79,7 +82,9 @@ def build_put_non_retry400_request(*, json: Any = None, content: Any = None, **k return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_non_retry201_creating400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_non_retry201_creating400_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -88,7 +93,7 @@ def build_put_non_retry201_creating400_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -147,7 +152,7 @@ def build_put_non_retry201_creating400_request(*, json: Any = None, content: Any def build_put_non_retry201_creating400_invalid_json_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -157,7 +162,7 @@ def build_put_non_retry201_creating400_invalid_json_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -215,7 +220,9 @@ def build_put_non_retry201_creating400_invalid_json_request( return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_async_relative_retry400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_async_relative_retry400_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -224,7 +231,7 @@ def build_put_async_relative_retry400_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -352,7 +359,7 @@ def build_delete_async_relative_retry400_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) -def build_post_non_retry400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_non_retry400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running post request, service returns a 400 with no error body. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -360,7 +367,7 @@ def build_post_non_retry400_request(*, json: Any = None, content: Any = None, ** :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -403,7 +410,7 @@ def build_post_non_retry400_request(*, json: Any = None, content: Any = None, ** return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post202_non_retry400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_non_retry400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 with a location header. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -411,7 +418,7 @@ def build_post202_non_retry400_request(*, json: Any = None, content: Any = None, :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -454,7 +461,9 @@ def build_post202_non_retry400_request(*, json: Any = None, content: Any = None, return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_async_relative_retry400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_async_relative_retry400_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -463,7 +472,7 @@ def build_post_async_relative_retry400_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -507,7 +516,7 @@ def build_post_async_relative_retry400_request(*, json: Any = None, content: Any def build_put_error201_no_provisioning_state_payload_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 201 to the initial request with no payload. @@ -516,7 +525,7 @@ def build_put_error201_no_provisioning_state_payload_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -575,7 +584,7 @@ def build_put_error201_no_provisioning_state_payload_request( def build_put_async_relative_retry_no_status_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -586,7 +595,7 @@ def build_put_async_relative_retry_no_status_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -645,7 +654,7 @@ def build_put_async_relative_retry_no_status_request( def build_put_async_relative_retry_no_status_payload_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -656,7 +665,7 @@ def build_put_async_relative_retry_no_status_payload_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -761,7 +770,7 @@ def build_delete_async_relative_retry_no_status_request(**kwargs: Any) -> HttpRe return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) -def build_post202_no_location_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_no_location_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -770,7 +779,7 @@ def build_post202_no_location_request(*, json: Any = None, content: Any = None, :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -814,7 +823,7 @@ def build_post202_no_location_request(*, json: Any = None, content: Any = None, def build_post_async_relative_retry_no_payload_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -825,7 +834,7 @@ def build_post_async_relative_retry_no_payload_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -868,7 +877,7 @@ def build_post_async_relative_retry_no_payload_request( return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put200_invalid_json_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put200_invalid_json_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -877,7 +886,7 @@ def build_put200_invalid_json_request(*, json: Any = None, content: Any = None, :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -936,7 +945,7 @@ def build_put200_invalid_json_request(*, json: Any = None, content: Any = None, def build_put_async_relative_retry_invalid_header_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -947,7 +956,7 @@ def build_put_async_relative_retry_invalid_header_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1006,7 +1015,7 @@ def build_put_async_relative_retry_invalid_header_request( def build_put_async_relative_retry_invalid_json_polling_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1017,7 +1026,7 @@ def build_put_async_relative_retry_invalid_json_polling_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1147,7 +1156,9 @@ def build_delete_async_relative_retry_invalid_json_polling_request(**kwargs: Any return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) -def build_post202_retry_invalid_header_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_retry_invalid_header_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -1156,7 +1167,7 @@ def build_post202_retry_invalid_header_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1200,7 +1211,7 @@ def build_post202_retry_invalid_header_request(*, json: Any = None, content: Any def build_post_async_relative_retry_invalid_header_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -1211,7 +1222,7 @@ def build_post_async_relative_retry_invalid_header_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any @@ -1255,7 +1266,7 @@ def build_post_async_relative_retry_invalid_header_request( def build_post_async_relative_retry_invalid_json_polling_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1266,7 +1277,7 @@ def build_post_async_relative_retry_invalid_json_polling_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Product to put. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py index e8942639284..50a425c4b45 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -40,7 +43,7 @@ def build_check_name_availability_request( our example to find the input shape. The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use @@ -128,7 +131,7 @@ def build_create_request( :paramtype api_version: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The parameters to provide for the created account. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The parameters to provide for the created account. :paramtype content: any @@ -434,7 +437,7 @@ def build_update_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The parameters to update on the account. Note that only one property can be changed at a time using this API. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The parameters to update on the account. Note that only one property can be changed at a time using this API. @@ -855,7 +858,7 @@ def build_regenerate_key_request( :paramtype api_version: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Specifies name of the key which should be regenerated. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Specifies name of the key which should be regenerated. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py index 828629ccc54..949ee4f63eb 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py @@ -5,18 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from ..._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() def build_check_name_availability_request( - subscription_id: str, *, json: Any = None, content: Any = None, **kwargs: Any + subscription_id: str, *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Checks that account name is valid and is not in use. @@ -33,7 +36,7 @@ def build_check_name_availability_request( our example to find the input shape. The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use @@ -95,7 +98,7 @@ def build_create_request( account_name: str, subscription_id: str, *, - json: Any = None, + json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: @@ -121,7 +124,7 @@ def build_create_request( :paramtype api_version: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The parameters to provide for the created account. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The parameters to provide for the created account. :paramtype content: any @@ -385,7 +388,7 @@ def build_update_request( account_name: str, subscription_id: str, *, - json: Any = None, + json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: @@ -415,7 +418,7 @@ def build_update_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The parameters to update on the account. Note that only one property can be changed at a time using this API. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The parameters to update on the account. Note that only one property can be changed at a time using this API. @@ -795,7 +798,7 @@ def build_regenerate_key_request( account_name: str, subscription_id: str, *, - json: Any = None, + json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: @@ -818,7 +821,7 @@ def build_regenerate_key_request( :paramtype api_version: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Specifies name of the key which should be regenerated. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Specifies name of the key which should be regenerated. :paramtype content: any diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py index 013ae0be260..7862243bf1b 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py index 3fc8310a015..ca4a3b57091 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py @@ -5,13 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from ..._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py index 2c86b4d91c3..65a5648e427 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py @@ -30,6 +30,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py index d1a41e3f0fa..9d73e0763de 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py index 2cf77685a46..ea11d444dd0 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py @@ -30,6 +30,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py index 2ed9de17570..417cc718255 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py @@ -29,6 +29,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/operations/_operations.py index b9c605b98d9..bf72176bb0e 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import build_get_report_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/operations/_operations.py index ad7aa7d6884..38f2a5b942a 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py index 1f9357ee3ff..2c32e378388 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import build_paging_first_response_empty_request, build_paging_get_multiple_pages_failure_request, build_paging_get_multiple_pages_failure_uri_request, build_paging_get_multiple_pages_fragment_next_link_request, build_paging_get_multiple_pages_fragment_with_grouping_next_link_request, build_paging_get_multiple_pages_lro_request_initial, build_paging_get_multiple_pages_request, build_paging_get_multiple_pages_retry_first_request, build_paging_get_multiple_pages_retry_second_request, build_paging_get_multiple_pages_with_offset_request, build_paging_get_no_item_name_pages_request, build_paging_get_null_next_link_name_pages_request, build_paging_get_odata_multiple_pages_request, build_paging_get_paging_model_with_item_name_with_xms_client_name_request, build_paging_get_single_pages_failure_request, build_paging_get_single_pages_request, build_paging_get_with_query_params_request, build_paging_next_fragment_request, build_paging_next_fragment_with_grouping_request, build_paging_next_operation_with_query_params_request T = TypeVar('T') +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PagingOperations: @@ -48,11 +49,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: def get_no_item_name_pages( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that must return result of the default 'value' node. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -71,7 +72,7 @@ def get_no_item_name_pages( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -122,11 +123,11 @@ async def get_next(next_link=None): def get_null_next_link_name_pages( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that must ignore any kind of nextLink, and stop after page 1. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -145,7 +146,7 @@ def get_null_next_link_name_pages( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -196,11 +197,11 @@ async def get_next(next_link=None): def get_single_pages( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that finishes on the first call without a nextlink. :return: An iterator like instance of JSON object - :rtype: ~custompollerpagerdefinitions.aio.AsyncCustomPager[Any] + :rtype: ~custompollerpagerdefinitions.aio.AsyncCustomPager[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -219,7 +220,7 @@ def get_single_pages( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -270,12 +271,12 @@ async def get_next(next_link=None): def first_response_empty( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -294,7 +295,7 @@ def first_response_empty( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -349,7 +350,7 @@ def get_multiple_pages( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages. :keyword client_request_id: @@ -360,7 +361,7 @@ def get_multiple_pages( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -379,7 +380,7 @@ def get_multiple_pages( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -438,7 +439,7 @@ def get_with_query_params( *, required_query_parameter: int, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -450,7 +451,7 @@ def get_with_query_params( value may result in unsupported behavior. :paramtype query_constant: bool :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -471,7 +472,7 @@ def get_with_query_params( """ query_constant = kwargs.pop('query_constant', True) # type: bool - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -529,7 +530,7 @@ def get_odata_multiple_pages( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink in odata format that has 10 pages. :keyword client_request_id: @@ -540,7 +541,7 @@ def get_odata_multiple_pages( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -559,7 +560,7 @@ def get_odata_multiple_pages( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -621,7 +622,7 @@ def get_multiple_pages_with_offset( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages. :param offset: Offset of return value. @@ -634,7 +635,7 @@ def get_multiple_pages_with_offset( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -653,7 +654,7 @@ def get_multiple_pages_with_offset( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -712,12 +713,12 @@ async def get_next(next_link=None): def get_multiple_pages_retry_first( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -736,7 +737,7 @@ def get_multiple_pages_retry_first( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -787,12 +788,12 @@ async def get_next(next_link=None): def get_multiple_pages_retry_second( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -811,7 +812,7 @@ def get_multiple_pages_retry_second( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -862,11 +863,11 @@ async def get_next(next_link=None): def get_single_pages_failure( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that receives a 400 on the first call. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -885,7 +886,7 @@ def get_single_pages_failure( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -936,11 +937,11 @@ async def get_next(next_link=None): def get_multiple_pages_failure( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that receives a 400 on the second call. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -959,7 +960,7 @@ def get_multiple_pages_failure( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1010,11 +1011,11 @@ async def get_next(next_link=None): def get_multiple_pages_failure_uri( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that receives an invalid nextLink. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1033,7 +1034,7 @@ def get_multiple_pages_failure_uri( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1087,7 +1088,7 @@ def get_multiple_pages_fragment_next_link( *, api_version: str, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment. :param tenant: Sets the tenant to use. @@ -1095,7 +1096,7 @@ def get_multiple_pages_fragment_next_link( :keyword api_version: Sets the api version to use. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1114,7 +1115,7 @@ def get_multiple_pages_fragment_next_link( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1173,7 +1174,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( *, api_version: str, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. :param tenant: Sets the tenant to use. @@ -1181,7 +1182,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( :keyword api_version: Sets the api version to use. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1200,7 +1201,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1259,8 +1260,8 @@ async def _get_multiple_pages_lro_initial( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> Any: - cls = kwargs.pop('cls', None) # type: ClsType[Any] + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1303,7 +1304,7 @@ async def begin_get_multiple_pages_lro( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> AsyncCustomPoller[AsyncItemPaged[Any]]: + ) -> AsyncCustomPoller[AsyncItemPaged[JSONType]]: """A long-running paging operation that includes a nextLink that has 10 pages. :keyword client_request_id: @@ -1322,11 +1323,11 @@ async def begin_get_multiple_pages_lro( Retry-After header is present. :return: An instance of AsyncCustomPoller that returns an iterator like instance of JSON object :rtype: - ~custompollerpagerdefinitions.aio.AsyncCustomPoller[~azure.core.async_paging.AsyncItemPaged[Any]] + ~custompollerpagerdefinitions.aio.AsyncCustomPoller[~azure.core.async_paging.AsyncItemPaged[JSONType]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1375,7 +1376,7 @@ async def get_next(next_link=None): polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1422,12 +1423,12 @@ async def internal_get_next(next_link=None): def get_paging_model_with_item_name_with_xms_client_name( self, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1446,7 +1447,7 @@ def get_paging_model_with_item_name_with_xms_client_name( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py index f2c883ef5d8..80fec288165 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union T = TypeVar('T') + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -574,11 +575,11 @@ def get_no_item_name_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that must return result of the default 'value' node. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -597,7 +598,7 @@ def get_no_item_name_pages( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -649,11 +650,11 @@ def get_null_next_link_name_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that must ignore any kind of nextLink, and stop after page 1. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -672,7 +673,7 @@ def get_null_next_link_name_pages( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -724,11 +725,11 @@ def get_single_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that finishes on the first call without a nextlink. :return: An iterator like instance of JSON object - :rtype: ~custompollerpagerdefinitions.CustomPager[Any] + :rtype: ~custompollerpagerdefinitions.CustomPager[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -747,7 +748,7 @@ def get_single_pages( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -799,12 +800,12 @@ def first_response_empty( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -823,7 +824,7 @@ def first_response_empty( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -875,7 +876,7 @@ def get_multiple_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a nextLink that has 10 pages. :keyword client_request_id: @@ -886,7 +887,7 @@ def get_multiple_pages( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -909,7 +910,7 @@ def get_multiple_pages( maxresults = kwargs.pop('maxresults', None) # type: Optional[int] timeout = kwargs.pop('timeout', 30) # type: Optional[int] - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -967,7 +968,7 @@ def get_with_query_params( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -979,7 +980,7 @@ def get_with_query_params( value may result in unsupported behavior. :paramtype query_constant: bool :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1001,7 +1002,7 @@ def get_with_query_params( query_constant = kwargs.pop('query_constant', True) # type: bool required_query_parameter = kwargs.pop('required_query_parameter') # type: int - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1056,7 +1057,7 @@ def get_odata_multiple_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a nextLink in odata format that has 10 pages. :keyword client_request_id: @@ -1067,7 +1068,7 @@ def get_odata_multiple_pages( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1090,7 +1091,7 @@ def get_odata_multiple_pages( maxresults = kwargs.pop('maxresults', None) # type: Optional[int] timeout = kwargs.pop('timeout', 30) # type: Optional[int] - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1149,7 +1150,7 @@ def get_multiple_pages_with_offset( offset, # type: int **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a nextLink that has 10 pages. :param offset: Offset of return value. @@ -1162,7 +1163,7 @@ def get_multiple_pages_with_offset( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1185,7 +1186,7 @@ def get_multiple_pages_with_offset( maxresults = kwargs.pop('maxresults', None) # type: Optional[int] timeout = kwargs.pop('timeout', 30) # type: Optional[int] - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1245,12 +1246,12 @@ def get_multiple_pages_retry_first( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1269,7 +1270,7 @@ def get_multiple_pages_retry_first( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1321,12 +1322,12 @@ def get_multiple_pages_retry_second( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1345,7 +1346,7 @@ def get_multiple_pages_retry_second( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1397,11 +1398,11 @@ def get_single_pages_failure( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that receives a 400 on the first call. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1420,7 +1421,7 @@ def get_single_pages_failure( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1472,11 +1473,11 @@ def get_multiple_pages_failure( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that receives a 400 on the second call. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1495,7 +1496,7 @@ def get_multiple_pages_failure( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1547,11 +1548,11 @@ def get_multiple_pages_failure_uri( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that receives an invalid nextLink. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1570,7 +1571,7 @@ def get_multiple_pages_failure_uri( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1623,7 +1624,7 @@ def get_multiple_pages_fragment_next_link( tenant, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that doesn't return a full URL, just a fragment. :param tenant: Sets the tenant to use. @@ -1631,7 +1632,7 @@ def get_multiple_pages_fragment_next_link( :keyword api_version: Sets the api version to use. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1652,7 +1653,7 @@ def get_multiple_pages_fragment_next_link( """ api_version = kwargs.pop('api_version') # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1710,7 +1711,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( tenant, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. :param tenant: Sets the tenant to use. @@ -1718,7 +1719,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( :keyword api_version: Sets the api version to use. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1739,7 +1740,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( """ api_version = kwargs.pop('api_version') # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1795,8 +1796,8 @@ def _get_multiple_pages_lro_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop('cls', None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1840,7 +1841,7 @@ def begin_get_multiple_pages_lro( self, **kwargs # type: Any ): - # type: (...) -> CustomPoller[ItemPaged[Any]] + # type: (...) -> CustomPoller[ItemPaged[JSONType]] """A long-running paging operation that includes a nextLink that has 10 pages. :keyword client_request_id: @@ -1858,7 +1859,7 @@ def begin_get_multiple_pages_lro( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of CustomPoller that returns an iterator like instance of JSON object - :rtype: ~custompollerpagerdefinitions.CustomPoller[~azure.core.paging.ItemPaged[Any]] + :rtype: ~custompollerpagerdefinitions.CustomPoller[~azure.core.paging.ItemPaged[JSONType]] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1866,7 +1867,7 @@ def begin_get_multiple_pages_lro( maxresults = kwargs.pop('maxresults', None) # type: Optional[int] timeout = kwargs.pop('timeout', 30) # type: Optional[int] - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1915,7 +1916,7 @@ def get_next(next_link=None): polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1963,12 +1964,12 @@ def get_paging_model_with_item_name_with_xms_client_name( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1987,7 +1988,7 @@ def get_paging_model_with_item_name_with_xms_client_name( ] } """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py index 494fcd01cec..c9cf593a74d 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py @@ -31,6 +31,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,14 +54,14 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace - def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> AsyncIterable[Any]: + def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that combines custom url, paging and partial URL and expect to concat after host. :param account_name: Account Name. :type account_name: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -79,7 +80,7 @@ def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> AsyncIterab ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -137,13 +138,13 @@ async def get_next(next_link=None): get_pages_partial_url.metadata = {"url": "/paging/customurl/partialnextlink"} # type: ignore @distributed_trace - def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> AsyncIterable[Any]: + def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that combines custom url, paging and partial URL with next operation. :param account_name: Account Name. :type account_name: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -162,7 +163,7 @@ def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> A ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py index 20685dd56af..40d213f9d85 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py @@ -31,6 +31,7 @@ from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -126,14 +127,14 @@ def get_pages_partial_url( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that combines custom url, paging and partial URL and expect to concat after host. :param account_name: Account Name. :type account_name: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -152,7 +153,7 @@ def get_pages_partial_url( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -215,13 +216,13 @@ def get_pages_partial_url_operation( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that combines custom url, paging and partial URL with next operation. :param account_name: Account Name. :type account_name: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -240,7 +241,7 @@ def get_pages_partial_url_operation( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py index ea6aaf4e7d5..18ad93bf778 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py @@ -108,6 +108,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -129,8 +130,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _put200_succeeded_initial(self, product: Any = None, **kwargs: Any) -> Optional[Any]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + async def _put200_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -170,12 +171,12 @@ async def _put200_succeeded_initial(self, product: Any = None, **kwargs: Any) -> _put200_succeeded_initial.metadata = {"url": "/lro/put/200/succeeded"} # type: ignore @distributed_trace_async - async def begin_put200_succeeded(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put200_succeeded(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -184,7 +185,7 @@ async def begin_put200_succeeded(self, product: Any = None, **kwargs: Any) -> As :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -222,7 +223,7 @@ async def begin_put200_succeeded(self, product: Any = None, **kwargs: Any) -> As """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -259,8 +260,8 @@ def get_long_running_output(pipeline_response): begin_put200_succeeded.metadata = {"url": "/lro/put/200/succeeded"} # type: ignore - async def _patch200_succeeded_ignore_headers_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _patch200_succeeded_ignore_headers_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -303,12 +304,14 @@ async def _patch200_succeeded_ignore_headers_initial(self, product: Any = None, _patch200_succeeded_ignore_headers_initial.metadata = {"url": "/lro/patch/200/succeeded/ignoreheaders"} # type: ignore @distributed_trace_async - async def begin_patch200_succeeded_ignore_headers(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_patch200_succeeded_ignore_headers( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. :param product: Product to patch. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -317,7 +320,7 @@ async def begin_patch200_succeeded_ignore_headers(self, product: Any = None, **k :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -355,7 +358,7 @@ async def begin_patch200_succeeded_ignore_headers(self, product: Any = None, **k """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -397,8 +400,8 @@ def get_long_running_output(pipeline_response): begin_patch200_succeeded_ignore_headers.metadata = {"url": "/lro/patch/200/succeeded/ignoreheaders"} # type: ignore - async def _put201_succeeded_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put201_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -436,12 +439,12 @@ async def _put201_succeeded_initial(self, product: Any = None, **kwargs: Any) -> _put201_succeeded_initial.metadata = {"url": "/lro/put/201/succeeded"} # type: ignore @distributed_trace_async - async def begin_put201_succeeded(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put201_succeeded(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -450,7 +453,7 @@ async def begin_put201_succeeded(self, product: Any = None, **kwargs: Any) -> As :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -488,7 +491,7 @@ async def begin_put201_succeeded(self, product: Any = None, **kwargs: Any) -> As """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -525,8 +528,8 @@ def get_long_running_output(pipeline_response): begin_put201_succeeded.metadata = {"url": "/lro/put/201/succeeded"} # type: ignore - async def _post202_list_initial(self, **kwargs: Any) -> Optional[List[Any]]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[Any]]] + async def _post202_list_initial(self, **kwargs: Any) -> Optional[List[JSONType]]: + cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[JSONType]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -564,7 +567,7 @@ async def _post202_list_initial(self, **kwargs: Any) -> Optional[List[Any]]: _post202_list_initial.metadata = {"url": "/lro/list"} # type: ignore @distributed_trace_async - async def begin_post202_list(self, **kwargs: Any) -> AsyncLROPoller[List[Any]]: + async def begin_post202_list(self, **kwargs: Any) -> AsyncLROPoller[List[JSONType]]: """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -576,7 +579,7 @@ async def begin_post202_list(self, **kwargs: Any) -> AsyncLROPoller[List[Any]]: :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns list of JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[list[Any]] + :rtype: ~azure.core.polling.AsyncLROPoller[list[JSONType]] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -600,7 +603,7 @@ async def begin_post202_list(self, **kwargs: Any) -> AsyncLROPoller[List[Any]]: ] """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -635,8 +638,8 @@ def get_long_running_output(pipeline_response): begin_post202_list.metadata = {"url": "/lro/list"} # type: ignore - async def _put200_succeeded_no_state_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put200_succeeded_no_state_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -674,12 +677,14 @@ async def _put200_succeeded_no_state_initial(self, product: Any = None, **kwargs _put200_succeeded_no_state_initial.metadata = {"url": "/lro/put/200/succeeded/nostate"} # type: ignore @distributed_trace_async - async def begin_put200_succeeded_no_state(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put200_succeeded_no_state( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -688,7 +693,7 @@ async def begin_put200_succeeded_no_state(self, product: Any = None, **kwargs: A :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -726,7 +731,7 @@ async def begin_put200_succeeded_no_state(self, product: Any = None, **kwargs: A """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -763,8 +768,8 @@ def get_long_running_output(pipeline_response): begin_put200_succeeded_no_state.metadata = {"url": "/lro/put/200/succeeded/nostate"} # type: ignore - async def _put202_retry200_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -802,13 +807,13 @@ async def _put202_retry200_initial(self, product: Any = None, **kwargs: Any) -> _put202_retry200_initial.metadata = {"url": "/lro/put/202/retry/200"} # type: ignore @distributed_trace_async - async def begin_put202_retry200(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put202_retry200(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -817,7 +822,7 @@ async def begin_put202_retry200(self, product: Any = None, **kwargs: Any) -> Asy :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -855,7 +860,7 @@ async def begin_put202_retry200(self, product: Any = None, **kwargs: Any) -> Asy """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -892,8 +897,8 @@ def get_long_running_output(pipeline_response): begin_put202_retry200.metadata = {"url": "/lro/put/202/retry/200"} # type: ignore - async def _put201_creating_succeeded200_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -938,13 +943,15 @@ async def _put201_creating_succeeded200_initial(self, product: Any = None, **kwa _put201_creating_succeeded200_initial.metadata = {"url": "/lro/put/201/creating/succeeded/200"} # type: ignore @distributed_trace_async - async def begin_put201_creating_succeeded200(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put201_creating_succeeded200( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -953,7 +960,7 @@ async def begin_put201_creating_succeeded200(self, product: Any = None, **kwargs :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -991,7 +998,7 @@ async def begin_put201_creating_succeeded200(self, product: Any = None, **kwargs """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1028,8 +1035,8 @@ def get_long_running_output(pipeline_response): begin_put201_creating_succeeded200.metadata = {"url": "/lro/put/201/creating/succeeded/200"} # type: ignore - async def _put200_updating_succeeded204_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put200_updating_succeeded204_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1067,13 +1074,15 @@ async def _put200_updating_succeeded204_initial(self, product: Any = None, **kwa _put200_updating_succeeded204_initial.metadata = {"url": "/lro/put/200/updating/succeeded/200"} # type: ignore @distributed_trace_async - async def begin_put200_updating_succeeded204(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put200_updating_succeeded204( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -1082,7 +1091,7 @@ async def begin_put200_updating_succeeded204(self, product: Any = None, **kwargs :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1120,7 +1129,7 @@ async def begin_put200_updating_succeeded204(self, product: Any = None, **kwargs """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1157,8 +1166,8 @@ def get_long_running_output(pipeline_response): begin_put200_updating_succeeded204.metadata = {"url": "/lro/put/200/updating/succeeded/200"} # type: ignore - async def _put201_creating_failed200_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put201_creating_failed200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1203,13 +1212,15 @@ async def _put201_creating_failed200_initial(self, product: Any = None, **kwargs _put201_creating_failed200_initial.metadata = {"url": "/lro/put/201/created/failed/200"} # type: ignore @distributed_trace_async - async def begin_put201_creating_failed200(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put201_creating_failed200( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -1218,7 +1229,7 @@ async def begin_put201_creating_failed200(self, product: Any = None, **kwargs: A :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1256,7 +1267,7 @@ async def begin_put201_creating_failed200(self, product: Any = None, **kwargs: A """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1293,8 +1304,8 @@ def get_long_running_output(pipeline_response): begin_put201_creating_failed200.metadata = {"url": "/lro/put/201/created/failed/200"} # type: ignore - async def _put200_acceptedcanceled200_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put200_acceptedcanceled200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1332,13 +1343,15 @@ async def _put200_acceptedcanceled200_initial(self, product: Any = None, **kwarg _put200_acceptedcanceled200_initial.metadata = {"url": "/lro/put/200/accepted/canceled/200"} # type: ignore @distributed_trace_async - async def begin_put200_acceptedcanceled200(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put200_acceptedcanceled200( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -1347,7 +1360,7 @@ async def begin_put200_acceptedcanceled200(self, product: Any = None, **kwargs: :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1385,7 +1398,7 @@ async def begin_put200_acceptedcanceled200(self, product: Any = None, **kwargs: """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1422,8 +1435,8 @@ def get_long_running_output(pipeline_response): begin_put200_acceptedcanceled200.metadata = {"url": "/lro/put/200/accepted/canceled/200"} # type: ignore - async def _put_no_header_in_retry_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_no_header_in_retry_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1464,12 +1477,12 @@ async def _put_no_header_in_retry_initial(self, product: Any = None, **kwargs: A _put_no_header_in_retry_initial.metadata = {"url": "/lro/put/noheader/202/200"} # type: ignore @distributed_trace_async - async def begin_put_no_header_in_retry(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_no_header_in_retry(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -1478,7 +1491,7 @@ async def begin_put_no_header_in_retry(self, product: Any = None, **kwargs: Any) :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1516,7 +1529,7 @@ async def begin_put_no_header_in_retry(self, product: Any = None, **kwargs: Any) """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1556,8 +1569,8 @@ def get_long_running_output(pipeline_response): begin_put_no_header_in_retry.metadata = {"url": "/lro/put/noheader/202/200"} # type: ignore - async def _put_async_retry_succeeded_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1602,13 +1615,15 @@ async def _put_async_retry_succeeded_initial(self, product: Any = None, **kwargs _put_async_retry_succeeded_initial.metadata = {"url": "/lro/putasync/retry/succeeded"} # type: ignore @distributed_trace_async - async def begin_put_async_retry_succeeded(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_retry_succeeded( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -1617,7 +1632,7 @@ async def begin_put_async_retry_succeeded(self, product: Any = None, **kwargs: A :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1655,7 +1670,7 @@ async def begin_put_async_retry_succeeded(self, product: Any = None, **kwargs: A """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1699,8 +1714,8 @@ def get_long_running_output(pipeline_response): begin_put_async_retry_succeeded.metadata = {"url": "/lro/putasync/retry/succeeded"} # type: ignore - async def _put_async_no_retry_succeeded_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_no_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1744,13 +1759,15 @@ async def _put_async_no_retry_succeeded_initial(self, product: Any = None, **kwa _put_async_no_retry_succeeded_initial.metadata = {"url": "/lro/putasync/noretry/succeeded"} # type: ignore @distributed_trace_async - async def begin_put_async_no_retry_succeeded(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_no_retry_succeeded( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -1759,7 +1776,7 @@ async def begin_put_async_no_retry_succeeded(self, product: Any = None, **kwargs :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1797,7 +1814,7 @@ async def begin_put_async_no_retry_succeeded(self, product: Any = None, **kwargs """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1840,8 +1857,8 @@ def get_long_running_output(pipeline_response): begin_put_async_no_retry_succeeded.metadata = {"url": "/lro/putasync/noretry/succeeded"} # type: ignore - async def _put_async_retry_failed_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_retry_failed_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1886,13 +1903,13 @@ async def _put_async_retry_failed_initial(self, product: Any = None, **kwargs: A _put_async_retry_failed_initial.metadata = {"url": "/lro/putasync/retry/failed"} # type: ignore @distributed_trace_async - async def begin_put_async_retry_failed(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_retry_failed(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -1901,7 +1918,7 @@ async def begin_put_async_retry_failed(self, product: Any = None, **kwargs: Any) :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1939,7 +1956,7 @@ async def begin_put_async_retry_failed(self, product: Any = None, **kwargs: Any) """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1983,8 +2000,8 @@ def get_long_running_output(pipeline_response): begin_put_async_retry_failed.metadata = {"url": "/lro/putasync/retry/failed"} # type: ignore - async def _put_async_no_retrycanceled_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_no_retrycanceled_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2028,13 +2045,15 @@ async def _put_async_no_retrycanceled_initial(self, product: Any = None, **kwarg _put_async_no_retrycanceled_initial.metadata = {"url": "/lro/putasync/noretry/canceled"} # type: ignore @distributed_trace_async - async def begin_put_async_no_retrycanceled(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_no_retrycanceled( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -2043,7 +2062,7 @@ async def begin_put_async_no_retrycanceled(self, product: Any = None, **kwargs: :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2081,7 +2100,7 @@ async def begin_put_async_no_retrycanceled(self, product: Any = None, **kwargs: """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2124,8 +2143,8 @@ def get_long_running_output(pipeline_response): begin_put_async_no_retrycanceled.metadata = {"url": "/lro/putasync/noretry/canceled"} # type: ignore - async def _put_async_no_header_in_retry_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_no_header_in_retry_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2168,13 +2187,15 @@ async def _put_async_no_header_in_retry_initial(self, product: Any = None, **kwa _put_async_no_header_in_retry_initial.metadata = {"url": "/lro/putasync/noheader/201/200"} # type: ignore @distributed_trace_async - async def begin_put_async_no_header_in_retry(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_no_header_in_retry( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -2183,7 +2204,7 @@ async def begin_put_async_no_header_in_retry(self, product: Any = None, **kwargs :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2221,7 +2242,7 @@ async def begin_put_async_no_header_in_retry(self, product: Any = None, **kwargs """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2263,8 +2284,8 @@ def get_long_running_output(pipeline_response): begin_put_async_no_header_in_retry.metadata = {"url": "/lro/putasync/noheader/201/200"} # type: ignore - async def _put_non_resource_initial(self, sku: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2302,11 +2323,11 @@ async def _put_non_resource_initial(self, sku: Any = None, **kwargs: Any) -> Any _put_non_resource_initial.metadata = {"url": "/lro/putnonresource/202/200"} # type: ignore @distributed_trace_async - async def begin_put_non_resource(self, sku: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_non_resource(self, sku: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request with non resource. :param sku: sku to put. - :type sku: Any + :type sku: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -2315,7 +2336,7 @@ async def begin_put_non_resource(self, sku: Any = None, **kwargs: Any) -> AsyncL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2335,7 +2356,7 @@ async def begin_put_non_resource(self, sku: Any = None, **kwargs: Any) -> AsyncL """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2372,8 +2393,8 @@ def get_long_running_output(pipeline_response): begin_put_non_resource.metadata = {"url": "/lro/putnonresource/202/200"} # type: ignore - async def _put_async_non_resource_initial(self, sku: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2411,11 +2432,11 @@ async def _put_async_non_resource_initial(self, sku: Any = None, **kwargs: Any) _put_async_non_resource_initial.metadata = {"url": "/lro/putnonresourceasync/202/200"} # type: ignore @distributed_trace_async - async def begin_put_async_non_resource(self, sku: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_non_resource(self, sku: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request with non resource. :param sku: Sku to put. - :type sku: Any + :type sku: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -2424,7 +2445,7 @@ async def begin_put_async_non_resource(self, sku: Any = None, **kwargs: Any) -> :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2444,7 +2465,7 @@ async def begin_put_async_non_resource(self, sku: Any = None, **kwargs: Any) -> """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2481,8 +2502,8 @@ def get_long_running_output(pipeline_response): begin_put_async_non_resource.metadata = {"url": "/lro/putnonresourceasync/202/200"} # type: ignore - async def _put_sub_resource_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_sub_resource_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2520,11 +2541,11 @@ async def _put_sub_resource_initial(self, product: Any = None, **kwargs: Any) -> _put_sub_resource_initial.metadata = {"url": "/lro/putsubresource/202/200"} # type: ignore @distributed_trace_async - async def begin_put_sub_resource(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_sub_resource(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request with sub resource. :param product: Sub Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -2533,7 +2554,7 @@ async def begin_put_sub_resource(self, product: Any = None, **kwargs: Any) -> As :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2559,7 +2580,7 @@ async def begin_put_sub_resource(self, product: Any = None, **kwargs: Any) -> As """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2596,8 +2617,8 @@ def get_long_running_output(pipeline_response): begin_put_sub_resource.metadata = {"url": "/lro/putsubresource/202/200"} # type: ignore - async def _put_async_sub_resource_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_sub_resource_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2635,11 +2656,11 @@ async def _put_async_sub_resource_initial(self, product: Any = None, **kwargs: A _put_async_sub_resource_initial.metadata = {"url": "/lro/putsubresourceasync/202/200"} # type: ignore @distributed_trace_async - async def begin_put_async_sub_resource(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_sub_resource(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request with sub resource. :param product: Sub Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -2648,7 +2669,7 @@ async def begin_put_async_sub_resource(self, product: Any = None, **kwargs: Any) :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2674,7 +2695,7 @@ async def begin_put_async_sub_resource(self, product: Any = None, **kwargs: Any) """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2711,8 +2732,8 @@ def get_long_running_output(pipeline_response): begin_put_async_sub_resource.metadata = {"url": "/lro/putsubresourceasync/202/200"} # type: ignore - async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2752,7 +2773,7 @@ async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: _delete_provisioning202_accepted200_succeeded_initial.metadata = {"url": "/lro/delete/provisioning/202/accepted/200/succeeded"} # type: ignore @distributed_trace_async - async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2765,7 +2786,7 @@ async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2787,7 +2808,7 @@ async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2824,8 +2845,8 @@ def get_long_running_output(pipeline_response): begin_delete_provisioning202_accepted200_succeeded.metadata = {"url": "/lro/delete/provisioning/202/accepted/200/succeeded"} # type: ignore - async def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2865,7 +2886,7 @@ async def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any _delete_provisioning202_deleting_failed200_initial.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/failed"} # type: ignore @distributed_trace_async - async def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -2878,7 +2899,7 @@ async def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2900,7 +2921,7 @@ async def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) - } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2935,8 +2956,8 @@ def get_long_running_output(pipeline_response): begin_delete_provisioning202_deleting_failed200.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/failed"} # type: ignore - async def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2976,7 +2997,7 @@ async def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: An _delete_provisioning202_deletingcanceled200_initial.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/canceled"} # type: ignore @distributed_trace_async - async def begin_delete_provisioning202_deletingcanceled200(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_delete_provisioning202_deletingcanceled200(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -2989,7 +3010,7 @@ async def begin_delete_provisioning202_deletingcanceled200(self, **kwargs: Any) :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3011,7 +3032,7 @@ async def begin_delete_provisioning202_deletingcanceled200(self, **kwargs: Any) } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3113,8 +3134,8 @@ def get_long_running_output(pipeline_response): begin_delete204_succeeded.metadata = {"url": "/lro/delete/204/succeeded"} # type: ignore - async def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[Any]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + async def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[JSONType]: + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3150,7 +3171,7 @@ async def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[Any]: _delete202_retry200_initial.metadata = {"url": "/lro/delete/202/retry/200"} # type: ignore @distributed_trace_async - async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -3162,7 +3183,7 @@ async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[Any]: :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3184,7 +3205,7 @@ async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[Any]: } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3219,8 +3240,8 @@ def get_long_running_output(pipeline_response): begin_delete202_retry200.metadata = {"url": "/lro/delete/202/retry/200"} # type: ignore - async def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[Any]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + async def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[JSONType]: + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3256,7 +3277,7 @@ async def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[Any]: _delete202_no_retry204_initial.metadata = {"url": "/lro/delete/202/noretry/204"} # type: ignore @distributed_trace_async - async def begin_delete202_no_retry204(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_delete202_no_retry204(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -3268,7 +3289,7 @@ async def begin_delete202_no_retry204(self, **kwargs: Any) -> AsyncLROPoller[Any :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3290,7 +3311,7 @@ async def begin_delete202_no_retry204(self, **kwargs: Any) -> AsyncLROPoller[Any } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3769,8 +3790,8 @@ def get_long_running_output(pipeline_response): begin_delete_async_retrycanceled.metadata = {"url": "/lro/deleteasync/retry/canceled"} # type: ignore - async def _post200_with_payload_initial(self, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _post200_with_payload_initial(self, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3806,7 +3827,7 @@ async def _post200_with_payload_initial(self, **kwargs: Any) -> Any: _post200_with_payload_initial.metadata = {"url": "/lro/post/payload/200"} # type: ignore @distributed_trace_async - async def begin_post200_with_payload(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_post200_with_payload(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. @@ -3818,7 +3839,7 @@ async def begin_post200_with_payload(self, **kwargs: Any) -> AsyncLROPoller[Any] :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3831,7 +3852,7 @@ async def begin_post200_with_payload(self, **kwargs: Any) -> AsyncLROPoller[Any] } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3866,7 +3887,7 @@ def get_long_running_output(pipeline_response): begin_post200_with_payload.metadata = {"url": "/lro/post/payload/200"} # type: ignore - async def _post202_retry200_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3902,12 +3923,12 @@ async def _post202_retry200_initial(self, product: Any = None, **kwargs: Any) -> _post202_retry200_initial.metadata = {"url": "/lro/post/202/retry/200"} # type: ignore @distributed_trace_async - async def begin_post202_retry200(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -3970,8 +3991,8 @@ def get_long_running_output(pipeline_response): begin_post202_retry200.metadata = {"url": "/lro/post/202/retry/200"} # type: ignore - async def _post202_no_retry204_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _post202_no_retry204_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4013,12 +4034,12 @@ async def _post202_no_retry204_initial(self, product: Any = None, **kwargs: Any) _post202_no_retry204_initial.metadata = {"url": "/lro/post/202/noretry/204"} # type: ignore @distributed_trace_async - async def begin_post202_no_retry204(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_post202_no_retry204(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -4027,7 +4048,7 @@ async def begin_post202_no_retry204(self, product: Any = None, **kwargs: Any) -> :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4065,7 +4086,7 @@ async def begin_post202_no_retry204(self, product: Any = None, **kwargs: Any) -> """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4106,8 +4127,8 @@ def get_long_running_output(pipeline_response): begin_post202_no_retry204.metadata = {"url": "/lro/post/202/noretry/204"} # type: ignore - async def _post_double_headers_final_location_get_initial(self, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _post_double_headers_final_location_get_initial(self, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4136,7 +4157,7 @@ async def _post_double_headers_final_location_get_initial(self, **kwargs: Any) - _post_double_headers_final_location_get_initial.metadata = {"url": "/lro/LROPostDoubleHeadersFinalLocationGet"} # type: ignore @distributed_trace_async - async def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final object. @@ -4149,7 +4170,7 @@ async def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> A :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4171,7 +4192,7 @@ async def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> A } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4206,8 +4227,8 @@ def get_long_running_output(pipeline_response): begin_post_double_headers_final_location_get.metadata = {"url": "/lro/LROPostDoubleHeadersFinalLocationGet"} # type: ignore - async def _post_double_headers_final_azure_header_get_initial(self, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _post_double_headers_final_azure_header_get_initial(self, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4236,7 +4257,7 @@ async def _post_double_headers_final_azure_header_get_initial(self, **kwargs: An _post_double_headers_final_azure_header_get_initial.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGet"} # type: ignore @distributed_trace_async - async def begin_post_double_headers_final_azure_header_get(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_post_double_headers_final_azure_header_get(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object. @@ -4249,7 +4270,7 @@ async def begin_post_double_headers_final_azure_header_get(self, **kwargs: Any) :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4271,7 +4292,7 @@ async def begin_post_double_headers_final_azure_header_get(self, **kwargs: Any) } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4308,8 +4329,8 @@ def get_long_running_output(pipeline_response): begin_post_double_headers_final_azure_header_get.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGet"} # type: ignore - async def _post_double_headers_final_azure_header_get_default_initial(self, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _post_double_headers_final_azure_header_get_default_initial(self, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4338,7 +4359,7 @@ async def _post_double_headers_final_azure_header_get_default_initial(self, **kw _post_double_headers_final_azure_header_get_default_initial.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault"} # type: ignore @distributed_trace_async - async def begin_post_double_headers_final_azure_header_get_default(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_post_double_headers_final_azure_header_get_default(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object if you support initial Autorest behavior. @@ -4351,7 +4372,7 @@ async def begin_post_double_headers_final_azure_header_get_default(self, **kwarg :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4373,7 +4394,7 @@ async def begin_post_double_headers_final_azure_header_get_default(self, **kwarg } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4410,8 +4431,8 @@ def get_long_running_output(pipeline_response): begin_post_double_headers_final_azure_header_get_default.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault"} # type: ignore - async def _post_async_retry_succeeded_initial(self, product: Any = None, **kwargs: Any) -> Optional[Any]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + async def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4459,13 +4480,15 @@ async def _post_async_retry_succeeded_initial(self, product: Any = None, **kwarg _post_async_retry_succeeded_initial.metadata = {"url": "/lro/postasync/retry/succeeded"} # type: ignore @distributed_trace_async - async def begin_post_async_retry_succeeded(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_post_async_retry_succeeded( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -4474,7 +4497,7 @@ async def begin_post_async_retry_succeeded(self, product: Any = None, **kwargs: :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4512,7 +4535,7 @@ async def begin_post_async_retry_succeeded(self, product: Any = None, **kwargs: """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4549,8 +4572,10 @@ def get_long_running_output(pipeline_response): begin_post_async_retry_succeeded.metadata = {"url": "/lro/postasync/retry/succeeded"} # type: ignore - async def _post_async_no_retry_succeeded_initial(self, product: Any = None, **kwargs: Any) -> Optional[Any]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + async def _post_async_no_retry_succeeded_initial( + self, product: JSONType = None, **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4598,13 +4623,15 @@ async def _post_async_no_retry_succeeded_initial(self, product: Any = None, **kw _post_async_no_retry_succeeded_initial.metadata = {"url": "/lro/postasync/noretry/succeeded"} # type: ignore @distributed_trace_async - async def begin_post_async_no_retry_succeeded(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_post_async_no_retry_succeeded( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -4613,7 +4640,7 @@ async def begin_post_async_no_retry_succeeded(self, product: Any = None, **kwarg :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4651,7 +4678,7 @@ async def begin_post_async_no_retry_succeeded(self, product: Any = None, **kwarg """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4688,7 +4715,7 @@ def get_long_running_output(pipeline_response): begin_post_async_no_retry_succeeded.metadata = {"url": "/lro/postasync/noretry/succeeded"} # type: ignore - async def _post_async_retry_failed_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post_async_retry_failed_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4727,13 +4754,13 @@ async def _post_async_retry_failed_initial(self, product: Any = None, **kwargs: _post_async_retry_failed_initial.metadata = {"url": "/lro/postasync/retry/failed"} # type: ignore @distributed_trace_async - async def begin_post_async_retry_failed(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_async_retry_failed(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -4796,7 +4823,7 @@ def get_long_running_output(pipeline_response): begin_post_async_retry_failed.metadata = {"url": "/lro/postasync/retry/failed"} # type: ignore - async def _post_async_retrycanceled_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post_async_retrycanceled_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4835,13 +4862,13 @@ async def _post_async_retrycanceled_initial(self, product: Any = None, **kwargs: _post_async_retrycanceled_initial.metadata = {"url": "/lro/postasync/retry/canceled"} # type: ignore @distributed_trace_async - async def begin_post_async_retrycanceled(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_async_retrycanceled(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -4923,8 +4950,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _put201_creating_succeeded200_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4969,13 +4996,15 @@ async def _put201_creating_succeeded200_initial(self, product: Any = None, **kwa _put201_creating_succeeded200_initial.metadata = {"url": "/lro/retryerror/put/201/creating/succeeded/200"} # type: ignore @distributed_trace_async - async def begin_put201_creating_succeeded200(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put201_creating_succeeded200( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -4984,7 +5013,7 @@ async def begin_put201_creating_succeeded200(self, product: Any = None, **kwargs :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5022,7 +5051,7 @@ async def begin_put201_creating_succeeded200(self, product: Any = None, **kwargs """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -5059,8 +5088,8 @@ def get_long_running_output(pipeline_response): begin_put201_creating_succeeded200.metadata = {"url": "/lro/retryerror/put/201/creating/succeeded/200"} # type: ignore - async def _put_async_relative_retry_succeeded_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_relative_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5105,13 +5134,15 @@ async def _put_async_relative_retry_succeeded_initial(self, product: Any = None, _put_async_relative_retry_succeeded_initial.metadata = {"url": "/lro/retryerror/putasync/retry/succeeded"} # type: ignore @distributed_trace_async - async def begin_put_async_relative_retry_succeeded(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_relative_retry_succeeded( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -5120,7 +5151,7 @@ async def begin_put_async_relative_retry_succeeded(self, product: Any = None, ** :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5158,7 +5189,7 @@ async def begin_put_async_relative_retry_succeeded(self, product: Any = None, ** """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -5202,8 +5233,8 @@ def get_long_running_output(pipeline_response): begin_put_async_relative_retry_succeeded.metadata = {"url": "/lro/retryerror/putasync/retry/succeeded"} # type: ignore - async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5243,7 +5274,7 @@ async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: _delete_provisioning202_accepted200_succeeded_initial.metadata = {"url": "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded"} # type: ignore @distributed_trace_async - async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -5256,7 +5287,7 @@ async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5278,7 +5309,7 @@ async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -5462,7 +5493,7 @@ def get_long_running_output(pipeline_response): begin_delete_async_relative_retry_succeeded.metadata = {"url": "/lro/retryerror/deleteasync/retry/succeeded"} # type: ignore - async def _post202_retry200_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5498,12 +5529,12 @@ async def _post202_retry200_initial(self, product: Any = None, **kwargs: Any) -> _post202_retry200_initial.metadata = {"url": "/lro/retryerror/post/202/retry/200"} # type: ignore @distributed_trace_async - async def begin_post202_retry200(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -5566,7 +5597,7 @@ def get_long_running_output(pipeline_response): begin_post202_retry200.metadata = {"url": "/lro/retryerror/post/202/retry/200"} # type: ignore - async def _post_async_relative_retry_succeeded_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post_async_relative_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5606,14 +5637,14 @@ async def _post_async_relative_retry_succeeded_initial(self, product: Any = None @distributed_trace_async async def begin_post_async_relative_retry_succeeded( - self, product: Any = None, **kwargs: Any + self, product: JSONType = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -5695,8 +5726,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _put_non_retry400_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5741,11 +5772,11 @@ async def _put_non_retry400_initial(self, product: Any = None, **kwargs: Any) -> _put_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/put/400"} # type: ignore @distributed_trace_async - async def begin_put_non_retry400(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_non_retry400(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 400 to the initial request. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -5754,7 +5785,7 @@ async def begin_put_non_retry400(self, product: Any = None, **kwargs: Any) -> As :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5792,7 +5823,7 @@ async def begin_put_non_retry400(self, product: Any = None, **kwargs: Any) -> As """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -5829,8 +5860,8 @@ def get_long_running_output(pipeline_response): begin_put_non_retry400.metadata = {"url": "/lro/nonretryerror/put/400"} # type: ignore - async def _put_non_retry201_creating400_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_non_retry201_creating400_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5875,12 +5906,14 @@ async def _put_non_retry201_creating400_initial(self, product: Any = None, **kwa _put_non_retry201_creating400_initial.metadata = {"url": "/lro/nonretryerror/put/201/creating/400"} # type: ignore @distributed_trace_async - async def begin_put_non_retry201_creating400(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_non_retry201_creating400( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -5889,7 +5922,7 @@ async def begin_put_non_retry201_creating400(self, product: Any = None, **kwargs :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5927,7 +5960,7 @@ async def begin_put_non_retry201_creating400(self, product: Any = None, **kwargs """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -5964,8 +5997,10 @@ def get_long_running_output(pipeline_response): begin_put_non_retry201_creating400.metadata = {"url": "/lro/nonretryerror/put/201/creating/400"} # type: ignore - async def _put_non_retry201_creating400_invalid_json_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_non_retry201_creating400_invalid_json_initial( + self, product: JSONType = None, **kwargs: Any + ) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6011,13 +6046,13 @@ async def _put_non_retry201_creating400_invalid_json_initial(self, product: Any @distributed_trace_async async def begin_put_non_retry201_creating400_invalid_json( - self, product: Any = None, **kwargs: Any - ) -> AsyncLROPoller[Any]: + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -6026,7 +6061,7 @@ async def begin_put_non_retry201_creating400_invalid_json( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6064,7 +6099,7 @@ async def begin_put_non_retry201_creating400_invalid_json( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -6101,8 +6136,8 @@ def get_long_running_output(pipeline_response): begin_put_non_retry201_creating400_invalid_json.metadata = {"url": "/lro/nonretryerror/put/201/creating/400/invalidjson"} # type: ignore - async def _put_async_relative_retry400_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_relative_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6147,12 +6182,14 @@ async def _put_async_relative_retry400_initial(self, product: Any = None, **kwar _put_async_relative_retry400_initial.metadata = {"url": "/lro/nonretryerror/putasync/retry/400"} # type: ignore @distributed_trace_async - async def begin_put_async_relative_retry400(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_relative_retry400( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -6161,7 +6198,7 @@ async def begin_put_async_relative_retry400(self, product: Any = None, **kwargs: :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6199,7 +6236,7 @@ async def begin_put_async_relative_retry400(self, product: Any = None, **kwargs: """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -6460,7 +6497,7 @@ def get_long_running_output(pipeline_response): begin_delete_async_relative_retry400.metadata = {"url": "/lro/nonretryerror/deleteasync/retry/400"} # type: ignore - async def _post_non_retry400_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6496,11 +6533,11 @@ async def _post_non_retry400_initial(self, product: Any = None, **kwargs: Any) - _post_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/post/400"} # type: ignore @distributed_trace_async - async def begin_post_non_retry400(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_non_retry400(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """Long running post request, service returns a 400 with no error body. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -6563,7 +6600,7 @@ def get_long_running_output(pipeline_response): begin_post_non_retry400.metadata = {"url": "/lro/nonretryerror/post/400"} # type: ignore - async def _post202_non_retry400_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post202_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6599,11 +6636,11 @@ async def _post202_non_retry400_initial(self, product: Any = None, **kwargs: Any _post202_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/post/202/retry/400"} # type: ignore @distributed_trace_async - async def begin_post202_non_retry400(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_non_retry400(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 with a location header. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -6666,7 +6703,7 @@ def get_long_running_output(pipeline_response): begin_post202_non_retry400.metadata = {"url": "/lro/nonretryerror/post/202/retry/400"} # type: ignore - async def _post_async_relative_retry400_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post_async_relative_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6705,12 +6742,12 @@ async def _post_async_relative_retry400_initial(self, product: Any = None, **kwa _post_async_relative_retry400_initial.metadata = {"url": "/lro/nonretryerror/postasync/retry/400"} # type: ignore @distributed_trace_async - async def begin_post_async_relative_retry400(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_async_relative_retry400(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -6773,8 +6810,10 @@ def get_long_running_output(pipeline_response): begin_post_async_relative_retry400.metadata = {"url": "/lro/nonretryerror/postasync/retry/400"} # type: ignore - async def _put_error201_no_provisioning_state_payload_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_error201_no_provisioning_state_payload_initial( + self, product: JSONType = None, **kwargs: Any + ) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6820,12 +6859,12 @@ async def _put_error201_no_provisioning_state_payload_initial(self, product: Any @distributed_trace_async async def begin_put_error201_no_provisioning_state_payload( - self, product: Any = None, **kwargs: Any - ) -> AsyncLROPoller[Any]: + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request with no payload. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -6834,7 +6873,7 @@ async def begin_put_error201_no_provisioning_state_payload( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6872,7 +6911,7 @@ async def begin_put_error201_no_provisioning_state_payload( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -6909,8 +6948,8 @@ def get_long_running_output(pipeline_response): begin_put_error201_no_provisioning_state_payload.metadata = {"url": "/lro/error/put/201/noprovisioningstatepayload"} # type: ignore - async def _put_async_relative_retry_no_status_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_relative_retry_no_status_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6955,13 +6994,15 @@ async def _put_async_relative_retry_no_status_initial(self, product: Any = None, _put_async_relative_retry_no_status_initial.metadata = {"url": "/lro/error/putasync/retry/nostatus"} # type: ignore @distributed_trace_async - async def begin_put_async_relative_retry_no_status(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_relative_retry_no_status( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -6970,7 +7011,7 @@ async def begin_put_async_relative_retry_no_status(self, product: Any = None, ** :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7008,7 +7049,7 @@ async def begin_put_async_relative_retry_no_status(self, product: Any = None, ** """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -7052,8 +7093,10 @@ def get_long_running_output(pipeline_response): begin_put_async_relative_retry_no_status.metadata = {"url": "/lro/error/putasync/retry/nostatus"} # type: ignore - async def _put_async_relative_retry_no_status_payload_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_relative_retry_no_status_payload_initial( + self, product: JSONType = None, **kwargs: Any + ) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7099,14 +7142,14 @@ async def _put_async_relative_retry_no_status_payload_initial(self, product: Any @distributed_trace_async async def begin_put_async_relative_retry_no_status_payload( - self, product: Any = None, **kwargs: Any - ) -> AsyncLROPoller[Any]: + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -7115,7 +7158,7 @@ async def begin_put_async_relative_retry_no_status_payload( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7153,7 +7196,7 @@ async def begin_put_async_relative_retry_no_status_payload( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -7339,7 +7382,7 @@ def get_long_running_output(pipeline_response): begin_delete_async_relative_retry_no_status.metadata = {"url": "/lro/error/deleteasync/retry/nostatus"} # type: ignore - async def _post202_no_location_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post202_no_location_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7375,12 +7418,12 @@ async def _post202_no_location_initial(self, product: Any = None, **kwargs: Any) _post202_no_location_initial.metadata = {"url": "/lro/error/post/202/nolocation"} # type: ignore @distributed_trace_async - async def begin_post202_no_location(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_no_location(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, without a location header. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -7443,7 +7486,7 @@ def get_long_running_output(pipeline_response): begin_post202_no_location.metadata = {"url": "/lro/error/post/202/nolocation"} # type: ignore - async def _post_async_relative_retry_no_payload_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post_async_relative_retry_no_payload_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7483,14 +7526,14 @@ async def _post_async_relative_retry_no_payload_initial(self, product: Any = Non @distributed_trace_async async def begin_post_async_relative_retry_no_payload( - self, product: Any = None, **kwargs: Any + self, product: JSONType = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -7553,8 +7596,8 @@ def get_long_running_output(pipeline_response): begin_post_async_relative_retry_no_payload.metadata = {"url": "/lro/error/postasync/retry/nopayload"} # type: ignore - async def _put200_invalid_json_initial(self, product: Any = None, **kwargs: Any) -> Optional[Any]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + async def _put200_invalid_json_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7594,12 +7637,12 @@ async def _put200_invalid_json_initial(self, product: Any = None, **kwargs: Any) _put200_invalid_json_initial.metadata = {"url": "/lro/error/put/200/invalidjson"} # type: ignore @distributed_trace_async - async def begin_put200_invalid_json(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put200_invalid_json(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -7608,7 +7651,7 @@ async def begin_put200_invalid_json(self, product: Any = None, **kwargs: Any) -> :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7646,7 +7689,7 @@ async def begin_put200_invalid_json(self, product: Any = None, **kwargs: Any) -> """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -7683,8 +7726,10 @@ def get_long_running_output(pipeline_response): begin_put200_invalid_json.metadata = {"url": "/lro/error/put/200/invalidjson"} # type: ignore - async def _put_async_relative_retry_invalid_header_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_relative_retry_invalid_header_initial( + self, product: JSONType = None, **kwargs: Any + ) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7730,14 +7775,14 @@ async def _put_async_relative_retry_invalid_header_initial(self, product: Any = @distributed_trace_async async def begin_put_async_relative_retry_invalid_header( - self, product: Any = None, **kwargs: Any - ) -> AsyncLROPoller[Any]: + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -7746,7 +7791,7 @@ async def begin_put_async_relative_retry_invalid_header( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7784,7 +7829,7 @@ async def begin_put_async_relative_retry_invalid_header( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -7828,8 +7873,10 @@ def get_long_running_output(pipeline_response): begin_put_async_relative_retry_invalid_header.metadata = {"url": "/lro/error/putasync/retry/invalidheader"} # type: ignore - async def _put_async_relative_retry_invalid_json_polling_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_relative_retry_invalid_json_polling_initial( + self, product: JSONType = None, **kwargs: Any + ) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7875,14 +7922,14 @@ async def _put_async_relative_retry_invalid_json_polling_initial(self, product: @distributed_trace_async async def begin_put_async_relative_retry_invalid_json_polling( - self, product: Any = None, **kwargs: Any - ) -> AsyncLROPoller[Any]: + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -7891,7 +7938,7 @@ async def begin_put_async_relative_retry_invalid_json_polling( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7929,7 +7976,7 @@ async def begin_put_async_relative_retry_invalid_json_polling( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -8197,7 +8244,7 @@ def get_long_running_output(pipeline_response): begin_delete_async_relative_retry_invalid_json_polling.metadata = {"url": "/lro/error/deleteasync/retry/invalidjsonpolling"} # type: ignore - async def _post202_retry_invalid_header_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post202_retry_invalid_header_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8233,12 +8280,12 @@ async def _post202_retry_invalid_header_initial(self, product: Any = None, **kwa _post202_retry_invalid_header_initial.metadata = {"url": "/lro/error/post/202/retry/invalidheader"} # type: ignore @distributed_trace_async - async def begin_post202_retry_invalid_header(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_retry_invalid_header(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -8301,7 +8348,7 @@ def get_long_running_output(pipeline_response): begin_post202_retry_invalid_header.metadata = {"url": "/lro/error/post/202/retry/invalidheader"} # type: ignore - async def _post_async_relative_retry_invalid_header_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post_async_relative_retry_invalid_header_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8341,14 +8388,14 @@ async def _post_async_relative_retry_invalid_header_initial(self, product: Any = @distributed_trace_async async def begin_post_async_relative_retry_invalid_header( - self, product: Any = None, **kwargs: Any + self, product: JSONType = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -8411,7 +8458,9 @@ def get_long_running_output(pipeline_response): begin_post_async_relative_retry_invalid_header.metadata = {"url": "/lro/error/postasync/retry/invalidheader"} # type: ignore - async def _post_async_relative_retry_invalid_json_polling_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post_async_relative_retry_invalid_json_polling_initial( + self, product: JSONType = None, **kwargs: Any + ) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8451,14 +8500,14 @@ async def _post_async_relative_retry_invalid_json_polling_initial(self, product: @distributed_trace_async async def begin_post_async_relative_retry_invalid_json_polling( - self, product: Any = None, **kwargs: Any + self, product: JSONType = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -8540,8 +8589,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _put_async_retry_succeeded_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8586,14 +8635,16 @@ async def _put_async_retry_succeeded_initial(self, product: Any = None, **kwargs _put_async_retry_succeeded_initial.metadata = {"url": "/lro/customheader/putasync/retry/succeeded"} # type: ignore @distributed_trace_async - async def begin_put_async_retry_succeeded(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put_async_retry_succeeded( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -8602,7 +8653,7 @@ async def begin_put_async_retry_succeeded(self, product: Any = None, **kwargs: A :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -8640,7 +8691,7 @@ async def begin_put_async_retry_succeeded(self, product: Any = None, **kwargs: A """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -8684,8 +8735,8 @@ def get_long_running_output(pipeline_response): begin_put_async_retry_succeeded.metadata = {"url": "/lro/customheader/putasync/retry/succeeded"} # type: ignore - async def _put201_creating_succeeded200_initial(self, product: Any = None, **kwargs: Any) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + async def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8730,14 +8781,16 @@ async def _put201_creating_succeeded200_initial(self, product: Any = None, **kwa _put201_creating_succeeded200_initial.metadata = {"url": "/lro/customheader/put/201/creating/succeeded/200"} # type: ignore @distributed_trace_async - async def begin_put201_creating_succeeded200(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[Any]: + async def begin_put201_creating_succeeded200( + self, product: JSONType = None, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -8746,7 +8799,7 @@ async def begin_put201_creating_succeeded200(self, product: Any = None, **kwargs :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -8784,7 +8837,7 @@ async def begin_put201_creating_succeeded200(self, product: Any = None, **kwargs """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -8821,7 +8874,7 @@ def get_long_running_output(pipeline_response): begin_put201_creating_succeeded200.metadata = {"url": "/lro/customheader/put/201/creating/succeeded/200"} # type: ignore - async def _post202_retry200_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8857,13 +8910,13 @@ async def _post202_retry200_initial(self, product: Any = None, **kwargs: Any) -> _post202_retry200_initial.metadata = {"url": "/lro/customheader/post/202/retry/200"} # type: ignore @distributed_trace_async - async def begin_post202_retry200(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal @@ -8926,7 +8979,7 @@ def get_long_running_output(pipeline_response): begin_post202_retry200.metadata = {"url": "/lro/customheader/post/202/retry/200"} # type: ignore - async def _post_async_retry_succeeded_initial(self, product: Any = None, **kwargs: Any) -> None: + async def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> None: cls = kwargs.pop("cls", None) # type: ClsType[None] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8965,14 +9018,14 @@ async def _post_async_retry_succeeded_initial(self, product: Any = None, **kwarg _post_async_retry_succeeded_initial.metadata = {"url": "/lro/customheader/postasync/retry/succeeded"} # type: ignore @distributed_trace_async - async def begin_post_async_retry_succeeded(self, product: Any = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_async_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py index cd7b503b6e7..dc77c41e70f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py @@ -31,6 +31,7 @@ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -1840,11 +1841,11 @@ def __init__(self, client, config, serializer, deserializer): def _put200_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Optional[Any] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + # type: (...) -> Optional[JSONType] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1886,15 +1887,15 @@ def _put200_succeeded_initial( @distributed_trace def begin_put200_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -1903,7 +1904,7 @@ def begin_put200_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1941,7 +1942,7 @@ def begin_put200_succeeded( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1980,11 +1981,11 @@ def get_long_running_output(pipeline_response): def _patch200_succeeded_ignore_headers_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2029,15 +2030,15 @@ def _patch200_succeeded_ignore_headers_initial( @distributed_trace def begin_patch200_succeeded_ignore_headers( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. :param product: Product to patch. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -2046,7 +2047,7 @@ def begin_patch200_succeeded_ignore_headers( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2084,7 +2085,7 @@ def begin_patch200_succeeded_ignore_headers( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2128,11 +2129,11 @@ def get_long_running_output(pipeline_response): def _put201_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2172,15 +2173,15 @@ def _put201_succeeded_initial( @distributed_trace def begin_put201_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -2189,7 +2190,7 @@ def begin_put201_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2227,7 +2228,7 @@ def begin_put201_succeeded( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2267,8 +2268,8 @@ def get_long_running_output(pipeline_response): def _post202_list_initial( self, **kwargs # type: Any ): - # type: (...) -> Optional[List[Any]] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[Any]]] + # type: (...) -> Optional[List[JSONType]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[JSONType]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2309,7 +2310,7 @@ def _post202_list_initial( def begin_post202_list( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[List[Any]] + # type: (...) -> LROPoller[List[JSONType]] """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -2321,7 +2322,7 @@ def begin_post202_list( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns list of JSON object - :rtype: ~azure.core.polling.LROPoller[list[Any]] + :rtype: ~azure.core.polling.LROPoller[list[JSONType]] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2345,7 +2346,7 @@ def begin_post202_list( ] """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2382,11 +2383,11 @@ def get_long_running_output(pipeline_response): def _put200_succeeded_no_state_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2426,15 +2427,15 @@ def _put200_succeeded_no_state_initial( @distributed_trace def begin_put200_succeeded_no_state( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -2443,7 +2444,7 @@ def begin_put200_succeeded_no_state( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2481,7 +2482,7 @@ def begin_put200_succeeded_no_state( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2520,11 +2521,11 @@ def get_long_running_output(pipeline_response): def _put202_retry200_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2564,16 +2565,16 @@ def _put202_retry200_initial( @distributed_trace def begin_put202_retry200( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -2582,7 +2583,7 @@ def begin_put202_retry200( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2620,7 +2621,7 @@ def begin_put202_retry200( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2659,11 +2660,11 @@ def get_long_running_output(pipeline_response): def _put201_creating_succeeded200_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2710,16 +2711,16 @@ def _put201_creating_succeeded200_initial( @distributed_trace def begin_put201_creating_succeeded200( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -2728,7 +2729,7 @@ def begin_put201_creating_succeeded200( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2766,7 +2767,7 @@ def begin_put201_creating_succeeded200( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2805,11 +2806,11 @@ def get_long_running_output(pipeline_response): def _put200_updating_succeeded204_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2849,16 +2850,16 @@ def _put200_updating_succeeded204_initial( @distributed_trace def begin_put200_updating_succeeded204( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -2867,7 +2868,7 @@ def begin_put200_updating_succeeded204( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2905,7 +2906,7 @@ def begin_put200_updating_succeeded204( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -2944,11 +2945,11 @@ def get_long_running_output(pipeline_response): def _put201_creating_failed200_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2995,16 +2996,16 @@ def _put201_creating_failed200_initial( @distributed_trace def begin_put201_creating_failed200( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -3013,7 +3014,7 @@ def begin_put201_creating_failed200( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3051,7 +3052,7 @@ def begin_put201_creating_failed200( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3090,11 +3091,11 @@ def get_long_running_output(pipeline_response): def _put200_acceptedcanceled200_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3134,16 +3135,16 @@ def _put200_acceptedcanceled200_initial( @distributed_trace def begin_put200_acceptedcanceled200( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -3152,7 +3153,7 @@ def begin_put200_acceptedcanceled200( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3190,7 +3191,7 @@ def begin_put200_acceptedcanceled200( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3229,11 +3230,11 @@ def get_long_running_output(pipeline_response): def _put_no_header_in_retry_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3276,15 +3277,15 @@ def _put_no_header_in_retry_initial( @distributed_trace def begin_put_no_header_in_retry( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -3293,7 +3294,7 @@ def begin_put_no_header_in_retry( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3331,7 +3332,7 @@ def begin_put_no_header_in_retry( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3373,11 +3374,11 @@ def get_long_running_output(pipeline_response): def _put_async_retry_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3424,16 +3425,16 @@ def _put_async_retry_succeeded_initial( @distributed_trace def begin_put_async_retry_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -3442,7 +3443,7 @@ def begin_put_async_retry_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3480,7 +3481,7 @@ def begin_put_async_retry_succeeded( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3526,11 +3527,11 @@ def get_long_running_output(pipeline_response): def _put_async_no_retry_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3576,16 +3577,16 @@ def _put_async_no_retry_succeeded_initial( @distributed_trace def begin_put_async_no_retry_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -3594,7 +3595,7 @@ def begin_put_async_no_retry_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3632,7 +3633,7 @@ def begin_put_async_no_retry_succeeded( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3677,11 +3678,11 @@ def get_long_running_output(pipeline_response): def _put_async_retry_failed_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3728,16 +3729,16 @@ def _put_async_retry_failed_initial( @distributed_trace def begin_put_async_retry_failed( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -3746,7 +3747,7 @@ def begin_put_async_retry_failed( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3784,7 +3785,7 @@ def begin_put_async_retry_failed( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3830,11 +3831,11 @@ def get_long_running_output(pipeline_response): def _put_async_no_retrycanceled_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3880,16 +3881,16 @@ def _put_async_no_retrycanceled_initial( @distributed_trace def begin_put_async_no_retrycanceled( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -3898,7 +3899,7 @@ def begin_put_async_no_retrycanceled( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3936,7 +3937,7 @@ def begin_put_async_no_retrycanceled( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -3981,11 +3982,11 @@ def get_long_running_output(pipeline_response): def _put_async_no_header_in_retry_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4030,16 +4031,16 @@ def _put_async_no_header_in_retry_initial( @distributed_trace def begin_put_async_no_header_in_retry( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -4048,7 +4049,7 @@ def begin_put_async_no_header_in_retry( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4086,7 +4087,7 @@ def begin_put_async_no_header_in_retry( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4130,11 +4131,11 @@ def get_long_running_output(pipeline_response): def _put_non_resource_initial( self, - sku=None, # type: Any + sku=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4174,14 +4175,14 @@ def _put_non_resource_initial( @distributed_trace def begin_put_non_resource( self, - sku=None, # type: Any + sku=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request with non resource. :param sku: sku to put. - :type sku: Any + :type sku: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -4190,7 +4191,7 @@ def begin_put_non_resource( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4210,7 +4211,7 @@ def begin_put_non_resource( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4249,11 +4250,11 @@ def get_long_running_output(pipeline_response): def _put_async_non_resource_initial( self, - sku=None, # type: Any + sku=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4293,14 +4294,14 @@ def _put_async_non_resource_initial( @distributed_trace def begin_put_async_non_resource( self, - sku=None, # type: Any + sku=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request with non resource. :param sku: Sku to put. - :type sku: Any + :type sku: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -4309,7 +4310,7 @@ def begin_put_async_non_resource( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4329,7 +4330,7 @@ def begin_put_async_non_resource( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4368,11 +4369,11 @@ def get_long_running_output(pipeline_response): def _put_sub_resource_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4412,14 +4413,14 @@ def _put_sub_resource_initial( @distributed_trace def begin_put_sub_resource( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request with sub resource. :param product: Sub Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -4428,7 +4429,7 @@ def begin_put_sub_resource( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4454,7 +4455,7 @@ def begin_put_sub_resource( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4493,11 +4494,11 @@ def get_long_running_output(pipeline_response): def _put_async_sub_resource_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4537,14 +4538,14 @@ def _put_async_sub_resource_initial( @distributed_trace def begin_put_async_sub_resource( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request with sub resource. :param product: Sub Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -4553,7 +4554,7 @@ def begin_put_async_sub_resource( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4579,7 +4580,7 @@ def begin_put_async_sub_resource( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4619,8 +4620,8 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_accepted200_succeeded_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4663,7 +4664,7 @@ def _delete_provisioning202_accepted200_succeeded_initial( def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -4676,7 +4677,7 @@ def begin_delete_provisioning202_accepted200_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4698,7 +4699,7 @@ def begin_delete_provisioning202_accepted200_succeeded( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4736,8 +4737,8 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_deleting_failed200_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4780,7 +4781,7 @@ def _delete_provisioning202_deleting_failed200_initial( def begin_delete_provisioning202_deleting_failed200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -4793,7 +4794,7 @@ def begin_delete_provisioning202_deleting_failed200( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4815,7 +4816,7 @@ def begin_delete_provisioning202_deleting_failed200( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -4853,8 +4854,8 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_deletingcanceled200_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4897,7 +4898,7 @@ def _delete_provisioning202_deletingcanceled200_initial( def begin_delete_provisioning202_deletingcanceled200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -4910,7 +4911,7 @@ def begin_delete_provisioning202_deletingcanceled200( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4932,7 +4933,7 @@ def begin_delete_provisioning202_deletingcanceled200( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -5043,8 +5044,8 @@ def get_long_running_output(pipeline_response): def _delete202_retry200_initial( self, **kwargs # type: Any ): - # type: (...) -> Optional[Any] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + # type: (...) -> Optional[JSONType] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5083,7 +5084,7 @@ def _delete202_retry200_initial( def begin_delete202_retry200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -5095,7 +5096,7 @@ def begin_delete202_retry200( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5117,7 +5118,7 @@ def begin_delete202_retry200( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -5155,8 +5156,8 @@ def get_long_running_output(pipeline_response): def _delete202_no_retry204_initial( self, **kwargs # type: Any ): - # type: (...) -> Optional[Any] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + # type: (...) -> Optional[JSONType] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5195,7 +5196,7 @@ def _delete202_no_retry204_initial( def begin_delete202_no_retry204( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -5207,7 +5208,7 @@ def begin_delete202_no_retry204( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5229,7 +5230,7 @@ def begin_delete202_no_retry204( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -5747,8 +5748,8 @@ def get_long_running_output(pipeline_response): def _post200_with_payload_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5787,7 +5788,7 @@ def _post200_with_payload_initial( def begin_post200_with_payload( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. @@ -5799,7 +5800,7 @@ def begin_post200_with_payload( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5812,7 +5813,7 @@ def begin_post200_with_payload( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -5849,7 +5850,7 @@ def get_long_running_output(pipeline_response): def _post202_retry200_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -5890,7 +5891,7 @@ def _post202_retry200_initial( @distributed_trace def begin_post202_retry200( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -5898,7 +5899,7 @@ def begin_post202_retry200( 'Retry-After' headers, Polls return a 200 with a response body after success. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -5963,11 +5964,11 @@ def get_long_running_output(pipeline_response): def _post202_no_retry204_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6011,15 +6012,15 @@ def _post202_no_retry204_initial( @distributed_trace def begin_post202_no_retry204( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -6028,7 +6029,7 @@ def begin_post202_no_retry204( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6066,7 +6067,7 @@ def begin_post202_no_retry204( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -6110,8 +6111,8 @@ def get_long_running_output(pipeline_response): def _post_double_headers_final_location_get_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6143,7 +6144,7 @@ def _post_double_headers_final_location_get_initial( def begin_post_double_headers_final_location_get( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final object. @@ -6156,7 +6157,7 @@ def begin_post_double_headers_final_location_get( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6178,7 +6179,7 @@ def begin_post_double_headers_final_location_get( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -6216,8 +6217,8 @@ def get_long_running_output(pipeline_response): def _post_double_headers_final_azure_header_get_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6249,7 +6250,7 @@ def _post_double_headers_final_azure_header_get_initial( def begin_post_double_headers_final_azure_header_get( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object. @@ -6262,7 +6263,7 @@ def begin_post_double_headers_final_azure_header_get( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6284,7 +6285,7 @@ def begin_post_double_headers_final_azure_header_get( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -6322,8 +6323,8 @@ def get_long_running_output(pipeline_response): def _post_double_headers_final_azure_header_get_default_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6355,7 +6356,7 @@ def _post_double_headers_final_azure_header_get_default_initial( def begin_post_double_headers_final_azure_header_get_default( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object if you support initial Autorest behavior. @@ -6368,7 +6369,7 @@ def begin_post_double_headers_final_azure_header_get_default( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6390,7 +6391,7 @@ def begin_post_double_headers_final_azure_header_get_default( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -6429,11 +6430,11 @@ def get_long_running_output(pipeline_response): def _post_async_retry_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Optional[Any] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + # type: (...) -> Optional[JSONType] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6483,16 +6484,16 @@ def _post_async_retry_succeeded_initial( @distributed_trace def begin_post_async_retry_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -6501,7 +6502,7 @@ def begin_post_async_retry_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6539,7 +6540,7 @@ def begin_post_async_retry_succeeded( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -6578,11 +6579,11 @@ def get_long_running_output(pipeline_response): def _post_async_no_retry_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Optional[Any] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + # type: (...) -> Optional[JSONType] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6632,16 +6633,16 @@ def _post_async_no_retry_succeeded_initial( @distributed_trace def begin_post_async_no_retry_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -6650,7 +6651,7 @@ def begin_post_async_no_retry_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6688,7 +6689,7 @@ def begin_post_async_no_retry_succeeded( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -6727,7 +6728,7 @@ def get_long_running_output(pipeline_response): def _post_async_retry_failed_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -6771,7 +6772,7 @@ def _post_async_retry_failed_initial( @distributed_trace def begin_post_async_retry_failed( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -6780,7 +6781,7 @@ def begin_post_async_retry_failed( header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -6845,7 +6846,7 @@ def get_long_running_output(pipeline_response): def _post_async_retrycanceled_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -6889,7 +6890,7 @@ def _post_async_retrycanceled_initial( @distributed_trace def begin_post_async_retrycanceled( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -6898,7 +6899,7 @@ def begin_post_async_retrycanceled( header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -6982,11 +6983,11 @@ def __init__(self, client, config, serializer, deserializer): def _put201_creating_succeeded200_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7033,16 +7034,16 @@ def _put201_creating_succeeded200_initial( @distributed_trace def begin_put201_creating_succeeded200( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -7051,7 +7052,7 @@ def begin_put201_creating_succeeded200( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7089,7 +7090,7 @@ def begin_put201_creating_succeeded200( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -7128,11 +7129,11 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7179,16 +7180,16 @@ def _put_async_relative_retry_succeeded_initial( @distributed_trace def begin_put_async_relative_retry_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -7197,7 +7198,7 @@ def begin_put_async_relative_retry_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7235,7 +7236,7 @@ def begin_put_async_relative_retry_succeeded( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -7282,8 +7283,8 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_accepted200_succeeded_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7326,7 +7327,7 @@ def _delete_provisioning202_accepted200_succeeded_initial( def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -7339,7 +7340,7 @@ def begin_delete_provisioning202_accepted200_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7361,7 +7362,7 @@ def begin_delete_provisioning202_accepted200_succeeded( } """ polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -7557,7 +7558,7 @@ def get_long_running_output(pipeline_response): def _post202_retry200_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -7598,7 +7599,7 @@ def _post202_retry200_initial( @distributed_trace def begin_post202_retry200( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -7606,7 +7607,7 @@ def begin_post202_retry200( 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -7671,7 +7672,7 @@ def get_long_running_output(pipeline_response): def _post_async_relative_retry_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -7715,7 +7716,7 @@ def _post_async_relative_retry_succeeded_initial( @distributed_trace def begin_post_async_relative_retry_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -7724,7 +7725,7 @@ def begin_post_async_relative_retry_succeeded( Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -7808,11 +7809,11 @@ def __init__(self, client, config, serializer, deserializer): def _put_non_retry400_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7859,14 +7860,14 @@ def _put_non_retry400_initial( @distributed_trace def begin_put_non_retry400( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 400 to the initial request. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -7875,7 +7876,7 @@ def begin_put_non_retry400( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7913,7 +7914,7 @@ def begin_put_non_retry400( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -7952,11 +7953,11 @@ def get_long_running_output(pipeline_response): def _put_non_retry201_creating400_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8003,15 +8004,15 @@ def _put_non_retry201_creating400_initial( @distributed_trace def begin_put_non_retry201_creating400( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -8020,7 +8021,7 @@ def begin_put_non_retry201_creating400( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -8058,7 +8059,7 @@ def begin_put_non_retry201_creating400( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -8097,11 +8098,11 @@ def get_long_running_output(pipeline_response): def _put_non_retry201_creating400_invalid_json_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8148,15 +8149,15 @@ def _put_non_retry201_creating400_invalid_json_initial( @distributed_trace def begin_put_non_retry201_creating400_invalid_json( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -8165,7 +8166,7 @@ def begin_put_non_retry201_creating400_invalid_json( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -8203,7 +8204,7 @@ def begin_put_non_retry201_creating400_invalid_json( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -8242,11 +8243,11 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry400_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -8293,15 +8294,15 @@ def _put_async_relative_retry400_initial( @distributed_trace def begin_put_async_relative_retry400( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -8310,7 +8311,7 @@ def begin_put_async_relative_retry400( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -8348,7 +8349,7 @@ def begin_put_async_relative_retry400( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -8629,7 +8630,7 @@ def get_long_running_output(pipeline_response): def _post_non_retry400_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -8670,14 +8671,14 @@ def _post_non_retry400_initial( @distributed_trace def begin_post_non_retry400( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running post request, service returns a 400 with no error body. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -8742,7 +8743,7 @@ def get_long_running_output(pipeline_response): def _post202_non_retry400_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -8783,14 +8784,14 @@ def _post202_non_retry400_initial( @distributed_trace def begin_post202_non_retry400( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 with a location header. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -8855,7 +8856,7 @@ def get_long_running_output(pipeline_response): def _post_async_relative_retry400_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -8899,7 +8900,7 @@ def _post_async_relative_retry400_initial( @distributed_trace def begin_post_async_relative_retry400( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -8907,7 +8908,7 @@ def begin_post_async_relative_retry400( indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -8972,11 +8973,11 @@ def get_long_running_output(pipeline_response): def _put_error201_no_provisioning_state_payload_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -9023,14 +9024,14 @@ def _put_error201_no_provisioning_state_payload_initial( @distributed_trace def begin_put_error201_no_provisioning_state_payload( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 201 to the initial request with no payload. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -9039,7 +9040,7 @@ def begin_put_error201_no_provisioning_state_payload( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -9077,7 +9078,7 @@ def begin_put_error201_no_provisioning_state_payload( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -9116,11 +9117,11 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_no_status_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -9167,16 +9168,16 @@ def _put_async_relative_retry_no_status_initial( @distributed_trace def begin_put_async_relative_retry_no_status( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -9185,7 +9186,7 @@ def begin_put_async_relative_retry_no_status( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -9223,7 +9224,7 @@ def begin_put_async_relative_retry_no_status( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -9269,11 +9270,11 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_no_status_payload_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -9320,16 +9321,16 @@ def _put_async_relative_retry_no_status_payload_initial( @distributed_trace def begin_put_async_relative_retry_no_status_payload( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -9338,7 +9339,7 @@ def begin_put_async_relative_retry_no_status_payload( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -9376,7 +9377,7 @@ def begin_put_async_relative_retry_no_status_payload( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -9576,7 +9577,7 @@ def get_long_running_output(pipeline_response): def _post202_no_location_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -9617,7 +9618,7 @@ def _post202_no_location_initial( @distributed_trace def begin_post202_no_location( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -9625,7 +9626,7 @@ def begin_post202_no_location( header. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -9690,7 +9691,7 @@ def get_long_running_output(pipeline_response): def _post_async_relative_retry_no_payload_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -9734,7 +9735,7 @@ def _post_async_relative_retry_no_payload_initial( @distributed_trace def begin_post_async_relative_retry_no_payload( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -9743,7 +9744,7 @@ def begin_post_async_relative_retry_no_payload( header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -9808,11 +9809,11 @@ def get_long_running_output(pipeline_response): def _put200_invalid_json_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Optional[Any] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + # type: (...) -> Optional[JSONType] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -9854,15 +9855,15 @@ def _put200_invalid_json_initial( @distributed_trace def begin_put200_invalid_json( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -9871,7 +9872,7 @@ def begin_put200_invalid_json( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -9909,7 +9910,7 @@ def begin_put200_invalid_json( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -9948,11 +9949,11 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_invalid_header_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -9999,16 +10000,16 @@ def _put_async_relative_retry_invalid_header_initial( @distributed_trace def begin_put_async_relative_retry_invalid_header( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -10017,7 +10018,7 @@ def begin_put_async_relative_retry_invalid_header( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -10055,7 +10056,7 @@ def begin_put_async_relative_retry_invalid_header( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -10101,11 +10102,11 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_invalid_json_polling_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -10152,16 +10153,16 @@ def _put_async_relative_retry_invalid_json_polling_initial( @distributed_trace def begin_put_async_relative_retry_invalid_json_polling( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -10170,7 +10171,7 @@ def begin_put_async_relative_retry_invalid_json_polling( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -10208,7 +10209,7 @@ def begin_put_async_relative_retry_invalid_json_polling( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -10494,7 +10495,7 @@ def get_long_running_output(pipeline_response): def _post202_retry_invalid_header_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -10535,7 +10536,7 @@ def _post202_retry_invalid_header_initial( @distributed_trace def begin_post202_retry_invalid_header( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -10543,7 +10544,7 @@ def begin_post202_retry_invalid_header( 'Location' and 'Retry-After' headers. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -10608,7 +10609,7 @@ def get_long_running_output(pipeline_response): def _post_async_relative_retry_invalid_header_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -10652,7 +10653,7 @@ def _post_async_relative_retry_invalid_header_initial( @distributed_trace def begin_post_async_relative_retry_invalid_header( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -10661,7 +10662,7 @@ def begin_post_async_relative_retry_invalid_header( header is invalid. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -10726,7 +10727,7 @@ def get_long_running_output(pipeline_response): def _post_async_relative_retry_invalid_json_polling_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -10770,7 +10771,7 @@ def _post_async_relative_retry_invalid_json_polling_initial( @distributed_trace def begin_post_async_relative_retry_invalid_json_polling( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -10779,7 +10780,7 @@ def begin_post_async_relative_retry_invalid_json_polling( header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -10863,11 +10864,11 @@ def __init__(self, client, config, serializer, deserializer): def _put_async_retry_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -10914,17 +10915,17 @@ def _put_async_retry_succeeded_initial( @distributed_trace def begin_put_async_retry_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -10933,7 +10934,7 @@ def begin_put_async_retry_succeeded( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -10971,7 +10972,7 @@ def begin_put_async_retry_succeeded( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -11017,11 +11018,11 @@ def get_long_running_output(pipeline_response): def _put201_creating_succeeded200_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -11068,17 +11069,17 @@ def _put201_creating_succeeded200_initial( @distributed_trace def begin_put201_creating_succeeded200( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -11087,7 +11088,7 @@ def begin_put201_creating_succeeded200( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -11125,7 +11126,7 @@ def begin_put201_creating_succeeded200( """ content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -11164,7 +11165,7 @@ def get_long_running_output(pipeline_response): def _post202_retry200_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -11205,7 +11206,7 @@ def _post202_retry200_initial( @distributed_trace def begin_post202_retry200( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -11214,7 +11215,7 @@ def begin_post202_retry200( 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling @@ -11279,7 +11280,7 @@ def get_long_running_output(pipeline_response): def _post_async_retry_succeeded_initial( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -11323,7 +11324,7 @@ def _post_async_retry_succeeded_initial( @distributed_trace def begin_post_async_retry_succeeded( self, - product=None, # type: Any + product=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -11333,7 +11334,7 @@ def begin_post_async_retry_succeeded( Azure-AsyncOperation header for operation status. :param product: Product to put. - :type product: Any + :type product: JSONType :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/operations/_operations.py index 79eb4db2fb2..34a2dd7d3b8 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/operations/_operations.py @@ -30,6 +30,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/operations/_operations.py index 9069d4b6343..f94094e1e42 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/operations/_operations.py @@ -32,6 +32,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py index 5e27810e0f9..d4af822b2d4 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py @@ -50,6 +50,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,11 +73,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace - def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable[Any]: + def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that must return result of the default 'value' node. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -95,7 +96,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable[Any]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -140,11 +141,11 @@ async def get_next(next_link=None): get_no_item_name_pages.metadata = {"url": "/paging/noitemname"} # type: ignore @distributed_trace - def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[Any]: + def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that must ignore any kind of nextLink, and stop after page 1. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -163,7 +164,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[Any]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -208,11 +209,11 @@ async def get_next(next_link=None): get_null_next_link_name_pages.metadata = {"url": "/paging/nullnextlink"} # type: ignore @distributed_trace - def get_single_pages(self, **kwargs: Any) -> AsyncIterable[Any]: + def get_single_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that finishes on the first call without a nextlink. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -231,7 +232,7 @@ def get_single_pages(self, **kwargs: Any) -> AsyncIterable[Any]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -276,12 +277,12 @@ async def get_next(next_link=None): get_single_pages.metadata = {"url": "/paging/single"} # type: ignore @distributed_trace - def first_response_empty(self, **kwargs: Any) -> AsyncIterable[Any]: + def first_response_empty(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -300,7 +301,7 @@ def first_response_empty(self, **kwargs: Any) -> AsyncIterable[Any]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -352,7 +353,7 @@ def get_multiple_pages( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages. :keyword client_request_id: @@ -363,7 +364,7 @@ def get_multiple_pages( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -382,7 +383,7 @@ def get_multiple_pages( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -433,7 +434,7 @@ async def get_next(next_link=None): get_multiple_pages.metadata = {"url": "/paging/multiple"} # type: ignore @distributed_trace - def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) -> AsyncIterable[Any]: + def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -445,7 +446,7 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) value may result in unsupported behavior. :paramtype query_constant: bool :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -466,7 +467,7 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) """ query_constant = kwargs.pop("query_constant", True) # type: bool - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -521,7 +522,7 @@ def get_odata_multiple_pages( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink in odata format that has 10 pages. :keyword client_request_id: @@ -532,7 +533,7 @@ def get_odata_multiple_pages( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -551,7 +552,7 @@ def get_odata_multiple_pages( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -610,7 +611,7 @@ def get_multiple_pages_with_offset( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages. :param offset: Offset of return value. @@ -623,7 +624,7 @@ def get_multiple_pages_with_offset( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -642,7 +643,7 @@ def get_multiple_pages_with_offset( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -695,12 +696,12 @@ async def get_next(next_link=None): get_multiple_pages_with_offset.metadata = {"url": "/paging/multiple/withpath/{offset}"} # type: ignore @distributed_trace - def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable[Any]: + def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -719,7 +720,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable[Any]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -764,12 +765,12 @@ async def get_next(next_link=None): get_multiple_pages_retry_first.metadata = {"url": "/paging/multiple/retryfirst"} # type: ignore @distributed_trace - def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable[Any]: + def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -788,7 +789,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable[Any]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -833,11 +834,11 @@ async def get_next(next_link=None): get_multiple_pages_retry_second.metadata = {"url": "/paging/multiple/retrysecond"} # type: ignore @distributed_trace - def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable[Any]: + def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that receives a 400 on the first call. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -856,7 +857,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable[Any]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -901,11 +902,11 @@ async def get_next(next_link=None): get_single_pages_failure.metadata = {"url": "/paging/single/failure"} # type: ignore @distributed_trace - def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable[Any]: + def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that receives a 400 on the second call. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -924,7 +925,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable[Any]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -969,11 +970,11 @@ async def get_next(next_link=None): get_multiple_pages_failure.metadata = {"url": "/paging/multiple/failure"} # type: ignore @distributed_trace - def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable[Any]: + def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that receives an invalid nextLink. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -992,7 +993,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable[Any]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1039,7 +1040,7 @@ async def get_next(next_link=None): @distributed_trace def get_multiple_pages_fragment_next_link( self, tenant: str, *, api_version: str, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment. :param tenant: Sets the tenant to use. @@ -1047,7 +1048,7 @@ def get_multiple_pages_fragment_next_link( :keyword api_version: Sets the api version to use. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1066,7 +1067,7 @@ def get_multiple_pages_fragment_next_link( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1118,7 +1119,7 @@ async def get_next(next_link=None): @distributed_trace def get_multiple_pages_fragment_with_grouping_next_link( self, tenant: str, *, api_version: str, **kwargs: Any - ) -> AsyncIterable[Any]: + ) -> AsyncIterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. :param tenant: Sets the tenant to use. @@ -1126,7 +1127,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( :keyword api_version: Sets the api version to use. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1145,7 +1146,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1201,8 +1202,8 @@ async def _get_multiple_pages_lro_initial( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> Any: - cls = kwargs.pop("cls", None) # type: ClsType[Any] + ) -> JSONType: + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1241,7 +1242,7 @@ async def begin_get_multiple_pages_lro( maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs: Any - ) -> AsyncLROPoller[AsyncItemPaged[Any]]: + ) -> AsyncLROPoller[AsyncItemPaged[JSONType]]: """A long-running paging operation that includes a nextLink that has 10 pages. :keyword client_request_id: @@ -1259,11 +1260,11 @@ async def begin_get_multiple_pages_lro( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns an iterator like instance of JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[Any]] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[JSONType]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1310,7 +1311,7 @@ async def get_next(next_link=None): return pipeline_response polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1351,12 +1352,12 @@ async def internal_get_next(next_link=None): begin_get_multiple_pages_lro.metadata = {"url": "/paging/multiple/lro"} # type: ignore @distributed_trace - def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> AsyncIterable[Any]: + def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> AsyncIterable[JSONType]: """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1375,7 +1376,7 @@ def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py index 8e308dfb42d..8f97fdca3e0 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py @@ -33,6 +33,7 @@ from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -578,11 +579,11 @@ def __init__(self, client, config, serializer, deserializer): def get_no_item_name_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that must return result of the default 'value' node. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -601,7 +602,7 @@ def get_no_item_name_pages( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -649,11 +650,11 @@ def get_next(next_link=None): def get_null_next_link_name_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that must ignore any kind of nextLink, and stop after page 1. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -672,7 +673,7 @@ def get_null_next_link_name_pages( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -720,11 +721,11 @@ def get_next(next_link=None): def get_single_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that finishes on the first call without a nextlink. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -743,7 +744,7 @@ def get_single_pages( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -791,12 +792,12 @@ def get_next(next_link=None): def first_response_empty( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -815,7 +816,7 @@ def first_response_empty( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -863,7 +864,7 @@ def get_next(next_link=None): def get_multiple_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a nextLink that has 10 pages. :keyword client_request_id: @@ -874,7 +875,7 @@ def get_multiple_pages( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -897,7 +898,7 @@ def get_multiple_pages( maxresults = kwargs.pop("maxresults", None) # type: Optional[int] timeout = kwargs.pop("timeout", 30) # type: Optional[int] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -951,7 +952,7 @@ def get_next(next_link=None): def get_with_query_params( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -963,7 +964,7 @@ def get_with_query_params( value may result in unsupported behavior. :paramtype query_constant: bool :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -985,7 +986,7 @@ def get_with_query_params( query_constant = kwargs.pop("query_constant", True) # type: bool required_query_parameter = kwargs.pop("required_query_parameter") # type: int - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1036,7 +1037,7 @@ def get_next(next_link=None): def get_odata_multiple_pages( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a nextLink in odata format that has 10 pages. :keyword client_request_id: @@ -1047,7 +1048,7 @@ def get_odata_multiple_pages( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1070,7 +1071,7 @@ def get_odata_multiple_pages( maxresults = kwargs.pop("maxresults", None) # type: Optional[int] timeout = kwargs.pop("timeout", 30) # type: Optional[int] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1126,7 +1127,7 @@ def get_multiple_pages_with_offset( offset, # type: int **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a nextLink that has 10 pages. :param offset: Offset of return value. @@ -1139,7 +1140,7 @@ def get_multiple_pages_with_offset( seconds. The default is 30 seconds. :paramtype timeout: int :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1162,7 +1163,7 @@ def get_multiple_pages_with_offset( maxresults = kwargs.pop("maxresults", None) # type: Optional[int] timeout = kwargs.pop("timeout", 30) # type: Optional[int] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1218,12 +1219,12 @@ def get_next(next_link=None): def get_multiple_pages_retry_first( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1242,7 +1243,7 @@ def get_multiple_pages_retry_first( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1290,12 +1291,12 @@ def get_next(next_link=None): def get_multiple_pages_retry_second( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1314,7 +1315,7 @@ def get_multiple_pages_retry_second( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1362,11 +1363,11 @@ def get_next(next_link=None): def get_single_pages_failure( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that receives a 400 on the first call. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1385,7 +1386,7 @@ def get_single_pages_failure( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1433,11 +1434,11 @@ def get_next(next_link=None): def get_multiple_pages_failure( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that receives a 400 on the second call. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1456,7 +1457,7 @@ def get_multiple_pages_failure( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1504,11 +1505,11 @@ def get_next(next_link=None): def get_multiple_pages_failure_uri( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that receives an invalid nextLink. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1527,7 +1528,7 @@ def get_multiple_pages_failure_uri( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1577,7 +1578,7 @@ def get_multiple_pages_fragment_next_link( tenant, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that doesn't return a full URL, just a fragment. :param tenant: Sets the tenant to use. @@ -1585,7 +1586,7 @@ def get_multiple_pages_fragment_next_link( :keyword api_version: Sets the api version to use. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1606,7 +1607,7 @@ def get_multiple_pages_fragment_next_link( """ api_version = kwargs.pop("api_version") # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1661,7 +1662,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( tenant, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. :param tenant: Sets the tenant to use. @@ -1669,7 +1670,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( :keyword api_version: Sets the api version to use. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1690,7 +1691,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( """ api_version = kwargs.pop("api_version") # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1742,8 +1743,8 @@ def get_next(next_link=None): def _get_multiple_pages_lro_initial( self, **kwargs # type: Any ): - # type: (...) -> Any - cls = kwargs.pop("cls", None) # type: ClsType[Any] + # type: (...) -> JSONType + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1782,7 +1783,7 @@ def _get_multiple_pages_lro_initial( def begin_get_multiple_pages_lro( self, **kwargs # type: Any ): - # type: (...) -> LROPoller[ItemPaged[Any]] + # type: (...) -> LROPoller[ItemPaged[JSONType]] """A long-running paging operation that includes a nextLink that has 10 pages. :keyword client_request_id: @@ -1800,7 +1801,7 @@ def begin_get_multiple_pages_lro( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of JSON object - :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[Any]] + :rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[JSONType]] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1808,7 +1809,7 @@ def begin_get_multiple_pages_lro( maxresults = kwargs.pop("maxresults", None) # type: Optional[int] timeout = kwargs.pop("timeout", 30) # type: Optional[int] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1855,7 +1856,7 @@ def get_next(next_link=None): return pipeline_response polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -1899,12 +1900,12 @@ def internal_get_next(next_link=None): def get_paging_model_with_item_name_with_xms_client_name( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1923,7 +1924,7 @@ def get_paging_model_with_item_name_with_xms_client_name( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py index a1da0ab235f..c1dd7352658 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py @@ -41,6 +41,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,18 +64,18 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def check_name_availability(self, account_name: Any, **kwargs: Any) -> Any: + async def check_name_availability(self, account_name: JSONType, **kwargs: Any) -> JSONType: """Checks that account name is valid and is not in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: Any + :type account_name: JSONType :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -93,7 +94,7 @@ async def check_name_availability(self, account_name: Any, **kwargs: Any) -> Any "reason": "str" # Optional. Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", "AlreadyExists". } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -131,9 +132,9 @@ async def check_name_availability(self, account_name: Any, **kwargs: Any) -> Any check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability"} # type: ignore async def _create_initial( - self, resource_group_name: str, account_name: str, parameters: Any, **kwargs: Any - ) -> Optional[Any]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + self, resource_group_name: str, account_name: str, parameters: JSONType, **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -176,8 +177,8 @@ async def _create_initial( @distributed_trace_async async def begin_create( - self, resource_group_name: str, account_name: str, parameters: Any, **kwargs: Any - ) -> AsyncLROPoller[Any]: + self, resource_group_name: str, account_name: str, parameters: JSONType, **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of @@ -190,7 +191,7 @@ async def begin_create( lower-case letters only. :type account_name: str :param parameters: The parameters to provide for the created account. - :type parameters: Any + :type parameters: JSONType :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -202,7 +203,7 @@ async def begin_create( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns JSON object - :rtype: ~azure.core.polling.AsyncLROPoller[Any] + :rtype: ~azure.core.polling.AsyncLROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -272,7 +273,7 @@ async def begin_create( api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -360,7 +361,7 @@ async def delete(self, resource_group_name: str, account_name: str, **kwargs: An delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore @distributed_trace_async - async def get_properties(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Any: + async def get_properties(self, resource_group_name: str, account_name: str, **kwargs: Any) -> JSONType: """Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -375,7 +376,7 @@ async def get_properties(self, resource_group_name: str, account_name: str, **kw overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -428,7 +429,7 @@ async def get_properties(self, resource_group_name: str, account_name: str, **kw "type": "str" # Optional. Resource type. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -463,7 +464,9 @@ async def get_properties(self, resource_group_name: str, account_name: str, **kw get_properties.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore @distributed_trace_async - async def update(self, resource_group_name: str, account_name: str, parameters: Any, **kwargs: Any) -> Any: + async def update( + self, resource_group_name: str, account_name: str, parameters: JSONType, **kwargs: Any + ) -> JSONType: """Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. This API can only be used to update one of tags, @@ -480,12 +483,12 @@ async def update(self, resource_group_name: str, account_name: str, parameters: :type account_name: str :param parameters: The parameters to update on the account. Note that only one property can be changed at a time using this API. - :type parameters: Any + :type parameters: JSONType :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -556,7 +559,7 @@ async def update(self, resource_group_name: str, account_name: str, parameters: "type": "str" # Optional. Resource type. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -596,7 +599,7 @@ async def update(self, resource_group_name: str, account_name: str, parameters: update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore @distributed_trace_async - async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Any: + async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> JSONType: """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user’s subscription. @@ -607,7 +610,7 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -619,7 +622,7 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: "key2": "str" # Optional. Gets the value of key 2. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -654,7 +657,7 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys"} # type: ignore @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable[Any]: + def list(self, **kwargs: Any) -> AsyncIterable[JSONType]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. @@ -662,7 +665,7 @@ def list(self, **kwargs: Any) -> AsyncIterable[Any]: overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -722,7 +725,7 @@ def list(self, **kwargs: Any) -> AsyncIterable[Any]: """ api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -771,7 +774,7 @@ async def get_next(next_link=None): list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts"} # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable[Any]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable[JSONType]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -781,7 +784,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -841,7 +844,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy """ api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -893,8 +896,8 @@ async def get_next(next_link=None): @distributed_trace_async async def regenerate_key( - self, resource_group_name: str, account_name: str, regenerate_key: Any, **kwargs: Any - ) -> Any: + self, resource_group_name: str, account_name: str, regenerate_key: JSONType, **kwargs: Any + ) -> JSONType: """Regenerates the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user’s subscription. @@ -904,12 +907,12 @@ async def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated. - :type regenerate_key: Any + :type regenerate_key: JSONType :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -926,7 +929,7 @@ async def regenerate_key( "key2": "str" # Optional. Gets the value of key 2. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -985,14 +988,14 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def list(self, **kwargs: Any) -> Any: + async def list(self, **kwargs: Any) -> JSONType: """Gets the current usage count and the limit for the resources under the subscription. :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1013,7 +1016,7 @@ async def list(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py index cb7224cd695..b4e30842d42 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py @@ -34,6 +34,7 @@ from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -422,21 +423,21 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def check_name_availability( self, - account_name, # type: Any + account_name, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Checks that account name is valid and is not in use. :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - :type account_name: Any + :type account_name: JSONType :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -455,7 +456,7 @@ def check_name_availability( "reason": "str" # Optional. Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", "AlreadyExists". } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -496,11 +497,11 @@ def _create_initial( self, resource_group_name, # type: str account_name, # type: str - parameters, # type: Any + parameters, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Optional[Any] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + # type: (...) -> Optional[JSONType] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -546,10 +547,10 @@ def begin_create( self, resource_group_name, # type: str account_name, # type: str - parameters, # type: Any + parameters, # type: JSONType **kwargs # type: Any ): - # type: (...) -> LROPoller[Any] + # type: (...) -> LROPoller[JSONType] """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of @@ -562,7 +563,7 @@ def begin_create( lower-case letters only. :type account_name: str :param parameters: The parameters to provide for the created account. - :type parameters: Any + :type parameters: JSONType :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -574,7 +575,7 @@ def begin_create( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[Any] + :rtype: ~azure.core.polling.LROPoller[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -644,7 +645,7 @@ def begin_create( api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: @@ -744,7 +745,7 @@ def get_properties( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -759,7 +760,7 @@ def get_properties( overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -812,7 +813,7 @@ def get_properties( "type": "str" # Optional. Resource type. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -851,10 +852,10 @@ def update( self, resource_group_name, # type: str account_name, # type: str - parameters, # type: Any + parameters, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. This API can only be used to update one of tags, @@ -871,12 +872,12 @@ def update( :type account_name: str :param parameters: The parameters to update on the account. Note that only one property can be changed at a time using this API. - :type parameters: Any + :type parameters: JSONType :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -947,7 +948,7 @@ def update( "type": "str" # Optional. Resource type. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -993,7 +994,7 @@ def list_keys( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user’s subscription. @@ -1004,7 +1005,7 @@ def list_keys( overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1016,7 +1017,7 @@ def list_keys( "key2": "str" # Optional. Gets the value of key 2. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1054,7 +1055,7 @@ def list_keys( def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. @@ -1062,7 +1063,7 @@ def list( overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1122,7 +1123,7 @@ def list( """ api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1176,7 +1177,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable[Any] + # type: (...) -> Iterable[JSONType] """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -1186,7 +1187,7 @@ def list_by_resource_group( overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: An iterator like instance of JSON object - :rtype: ~azure.core.paging.ItemPaged[Any] + :rtype: ~azure.core.paging.ItemPaged[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1246,7 +1247,7 @@ def list_by_resource_group( """ api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1301,10 +1302,10 @@ def regenerate_key( self, resource_group_name, # type: str account_name, # type: str - regenerate_key, # type: Any + regenerate_key, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Regenerates the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user’s subscription. @@ -1314,12 +1315,12 @@ def regenerate_key( lower-case letters only. :type account_name: str :param regenerate_key: Specifies name of the key which should be regenerated. - :type regenerate_key: Any + :type regenerate_key: JSONType :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1336,7 +1337,7 @@ def regenerate_key( "key2": "str" # Optional. Gets the value of key 2. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1398,14 +1399,14 @@ def __init__(self, client, config, serializer, deserializer): def list( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Gets the current usage count and the limit for the resources under the subscription. :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1426,7 +1427,7 @@ def list( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py index 8a4f0d577af..e54b36079dd 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py @@ -25,6 +25,7 @@ from ...operations._operations import build_group_get_sample_resource_group_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> Any: + async def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> JSONType: """Provides a resouce group with name 'testgroup101' and location 'West US'. :param resource_group_name: Resource Group name 'testgroup101'. @@ -56,7 +57,7 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -68,7 +69,7 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An "name": "str" # Optional. resource group name 'testgroup101'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py index 04e85965a3c..8aa61da0c0a 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py @@ -30,6 +30,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -94,7 +95,7 @@ def get_sample_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Provides a resouce group with name 'testgroup101' and location 'West US'. :param resource_group_name: Resource Group name 'testgroup101'. @@ -103,7 +104,7 @@ def get_sample_resource_group( overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -115,7 +116,7 @@ def get_sample_resource_group( "name": "str" # Optional. resource group name 'testgroup101'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders.py index 50a258b212c..0acb8d01d54 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -70,7 +73,7 @@ def build_post_parameters_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. I am a body parameter. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). I am a body parameter. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders_py3.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders_py3.py index a3c928e7f69..a51ca42d9ac 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders_py3.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -42,7 +45,7 @@ def build_get_required_request(*, parameter: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) -def build_post_parameters_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_parameters_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """POST a JSON. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -51,7 +54,7 @@ def build_post_parameters_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. I am a body parameter. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). I am a body parameter. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders.py index 2b762486a18..00cf6d0a202 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, IO, Optional, Union + from typing import Any, IO, Optional, TypeVar, Union + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -75,7 +78,7 @@ def build_post_parameters_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. I am a body parameter with a new content type. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). I am a body parameter with a new content type. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py index d68b039c954..fe0d4725ced 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Optional, Union +from typing import Any, IO, Optional, TypeVar, Union from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -46,7 +49,7 @@ def build_get_required_request(*, parameter: str, new_parameter: Optional[str] = return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) -def build_post_parameters_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_parameters_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """POST a JSON or a JPEG. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -55,7 +58,7 @@ def build_post_parameters_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. I am a body parameter with a new content type. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). I am a body parameter with a new content type. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/_operations.py index d770e820b9b..f4778808a85 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import build_params_get_required_request, build_params_post_parameters_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,12 +86,12 @@ async def get_required(self, *, parameter: str, **kwargs: Any) -> Any: get_required.metadata = {"url": "/servicedriven/parameters"} # type: ignore @distributed_trace_async - async def post_parameters(self, parameter: Any, **kwargs: Any) -> Any: + async def post_parameters(self, parameter: JSONType, **kwargs: Any) -> Any: """POST a JSON. :param parameter: I am a body parameter. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. - :type parameter: Any + :type parameter: JSONType :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/_operations.py index 22440b12a98..5595fd0ff7b 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -148,7 +149,7 @@ def get_required( @distributed_trace def post_parameters( self, - parameter, # type: Any + parameter, # type: JSONType **kwargs # type: Any ): # type: (...) -> Any @@ -156,7 +157,7 @@ def post_parameters( :param parameter: I am a body parameter. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. - :type parameter: Any + :type parameter: JSONType :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/_operations.py index 4a78ee36941..8bf30c08c9d 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/_operations.py @@ -29,6 +29,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,12 +94,12 @@ async def get_required(self, *, parameter: str, new_parameter: Optional[str] = N get_required.metadata = {"url": "/servicedriven/parameters"} # type: ignore @distributed_trace_async - async def post_parameters(self, parameter: Union[IO, Any], **kwargs: Any) -> Any: + async def post_parameters(self, parameter: Union[IO, JSONType], **kwargs: Any) -> Any: """POST a JSON or a JPEG. :param parameter: I am a body parameter with a new content type. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. - :type parameter: IO or Any + :type parameter: IO or JSONType :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". Allowed values are: "image/jpeg", "application/json." :return: any diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/_operations.py index 0be84759558..af00510f9e3 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -189,7 +190,7 @@ def get_required( @distributed_trace def post_parameters( self, - parameter, # type: Union[IO, Any] + parameter, # type: Union[IO, JSONType] **kwargs # type: Any ): # type: (...) -> Any @@ -197,7 +198,7 @@ def post_parameters( :param parameter: I am a body parameter with a new content type. My only valid JSON entry is { url: "http://example.org/myimage.jpeg" }. - :type parameter: IO or Any + :type parameter: IO or JSONType :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". Allowed values are: "image/jpeg", "application/json." :return: any diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py index d3bb14023c6..ac754a6bc21 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py @@ -27,6 +27,7 @@ from .._vendor import _convert_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -68,7 +69,7 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -96,7 +97,7 @@ def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_boolean_tfft_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_boolean_tfft_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -148,7 +149,7 @@ def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_integer_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_integer_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -200,7 +201,7 @@ def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_long_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_long_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -252,7 +253,7 @@ def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_float_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_float_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -304,7 +305,7 @@ def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_double_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_double_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -356,7 +357,7 @@ def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_string_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -384,7 +385,7 @@ def build_get_enum_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_enum_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_enum_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -412,7 +413,7 @@ def build_get_string_enum_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_string_enum_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_enum_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -464,7 +465,7 @@ def build_get_uuid_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_uuid_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_uuid_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -504,7 +505,7 @@ def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -556,7 +557,7 @@ def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -608,7 +609,9 @@ def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_rfc1123_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_rfc1123_valid_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -636,7 +639,7 @@ def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_duration_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_duration_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -664,7 +667,7 @@ def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_byte_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_byte_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -764,7 +767,7 @@ def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_complex_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_complex_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -840,7 +843,7 @@ def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_array_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_array_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -916,7 +919,7 @@ def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_dictionary_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_dictionary_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_array_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_array_operations_py3.py index 67c69feabe6..edc854e7851 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_array_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_array_operations_py3.py @@ -26,6 +26,7 @@ from .._vendor import _convert_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -43,7 +44,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -71,7 +72,7 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_basic_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_basic_operations_py3.py index d5ec126fb72..9f0cd2ff24e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_basic_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_basic_operations_py3.py @@ -26,6 +26,7 @@ from .._vendor import _convert_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -43,7 +44,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: api_version = kwargs.pop("api_version", "2016-02-29") # type: str content_type = kwargs.pop("content_type", None) # type: Optional[str] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_dictionary_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_dictionary_operations_py3.py index ec3a207f63b..1a83485d6f0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_dictionary_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_dictionary_operations_py3.py @@ -26,6 +26,7 @@ from .._vendor import _convert_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -43,7 +44,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -71,7 +72,7 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_inheritance_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_inheritance_operations_py3.py index 30afe5f61e6..a6f4b1d3b70 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_inheritance_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_inheritance_operations_py3.py @@ -26,6 +26,7 @@ from .._vendor import _convert_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -43,7 +44,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphicrecursive_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphicrecursive_operations_py3.py index c854b2edec6..e8a355ebf47 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphicrecursive_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphicrecursive_operations_py3.py @@ -26,6 +26,7 @@ from .._vendor import _convert_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -43,7 +44,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphism_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphism_operations_py3.py index f0d5791a97d..a36cf99d3fa 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphism_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphism_operations_py3.py @@ -26,6 +26,7 @@ from .._vendor import _convert_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -43,7 +44,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -107,7 +108,7 @@ def build_get_complicated_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_complicated_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_complicated_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -123,7 +124,9 @@ def build_put_complicated_request(*, json: Any = None, content: Any = None, **kw return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_missing_discriminator_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_missing_discriminator_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -139,7 +142,9 @@ def build_put_missing_discriminator_request(*, json: Any = None, content: Any = return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_valid_missing_required_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_missing_required_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_primitive_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_primitive_operations_py3.py index 1ac48012caf..0b0a00f4b30 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_primitive_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_primitive_operations_py3.py @@ -27,6 +27,7 @@ from .._vendor import _convert_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -44,7 +45,7 @@ def build_get_int_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_int_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_int_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -72,7 +73,7 @@ def build_get_long_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_long_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_long_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -100,7 +101,7 @@ def build_get_float_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_float_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -128,7 +129,7 @@ def build_get_double_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_double_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -156,7 +157,7 @@ def build_get_bool_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_bool_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_bool_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -184,7 +185,7 @@ def build_get_string_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_string_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -212,7 +213,7 @@ def build_get_date_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -240,7 +241,7 @@ def build_get_date_time_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -268,7 +269,7 @@ def build_get_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_rfc1123_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_rfc1123_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -296,7 +297,7 @@ def build_get_duration_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_duration_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -324,7 +325,7 @@ def build_get_byte_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_byte_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_byte_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_readonlyproperty_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_readonlyproperty_operations_py3.py index 5c07fc8cc45..a3290de6326 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_readonlyproperty_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_readonlyproperty_operations_py3.py @@ -26,6 +26,7 @@ from .._vendor import _convert_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -43,7 +44,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py index a2b13bf3504..2a048df63d9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -29,7 +32,7 @@ def build_create_ap_true_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -87,7 +90,7 @@ def build_create_cat_ap_true_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -147,7 +150,7 @@ def build_create_ap_object_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -205,7 +208,7 @@ def build_create_ap_string_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -263,7 +266,7 @@ def build_create_ap_in_properties_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -321,7 +324,7 @@ def build_create_ap_in_properties_with_ap_string_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py index 93fe677f702..0deec10a05a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py @@ -5,15 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_create_ap_true_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_create_ap_true_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -21,7 +24,7 @@ def build_create_ap_true_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -63,7 +66,7 @@ def build_create_ap_true_request(*, json: Any = None, content: Any = None, **kwa return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_create_cat_ap_true_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_create_cat_ap_true_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Create a CatAPTrue which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -71,7 +74,7 @@ def build_create_cat_ap_true_request(*, json: Any = None, content: Any = None, * :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -115,7 +118,7 @@ def build_create_cat_ap_true_request(*, json: Any = None, content: Any = None, * return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_create_ap_object_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_create_ap_object_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -123,7 +126,7 @@ def build_create_ap_object_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -165,7 +168,7 @@ def build_create_ap_object_request(*, json: Any = None, content: Any = None, **k return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_create_ap_string_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_create_ap_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -173,7 +176,7 @@ def build_create_ap_string_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -215,7 +218,7 @@ def build_create_ap_string_request(*, json: Any = None, content: Any = None, **k return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_create_ap_in_properties_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_create_ap_in_properties_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -223,7 +226,7 @@ def build_create_ap_in_properties_request(*, json: Any = None, content: Any = No :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -266,7 +269,7 @@ def build_create_ap_in_properties_request(*, json: Any = None, content: Any = No def build_create_ap_in_properties_with_ap_string_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Create a Pet which contains more properties than what is defined. @@ -275,7 +278,7 @@ def build_create_ap_in_properties_with_ap_string_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py index cb95d72bfe7..91038502723 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -63,7 +66,7 @@ def build_put_object_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Pass in {'foo': 'bar'} for a 200, anything else for an object error. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Pass in {'foo': 'bar'} for a 200, anything else for an object error. @@ -142,7 +145,7 @@ def build_put_string_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Pass in 'anything' for a 200, anything else for an object error. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Pass in 'anything' for a 200, anything else for an object error. @@ -221,7 +224,7 @@ def build_put_array_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Pass in ['foo', 'bar'] for a 200, anything else for an object error. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Pass in ['foo', 'bar'] for a 200, anything else for an object error. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py index f28bb7514c2..1748c562488 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -37,7 +40,7 @@ def build_get_object_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_object_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_object_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Basic put that puts an object as anything. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -47,7 +50,7 @@ def build_put_object_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Pass in {'foo': 'bar'} for a 200, anything else for an object error. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Pass in {'foo': 'bar'} for a 200, anything else for an object error. @@ -100,7 +103,7 @@ def build_get_string_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_string_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Basic put that puts an string as anything. Pass in 'anything' to get a 200 and anything else to get an object error. @@ -110,7 +113,7 @@ def build_put_string_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Pass in 'anything' for a 200, anything else for an object error. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Pass in 'anything' for a 200, anything else for an object error. @@ -163,7 +166,7 @@ def build_get_array_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_array_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_array_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Basic put that puts an array as anything. Pass in ['foo', 'bar'] to get a 200 and anything else to get an object error. @@ -173,7 +176,7 @@ def build_put_array_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Pass in ['foo', 'bar'] for a 200, anything else for an object error. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Pass in ['foo', 'bar'] for a 200, anything else for an object error. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py index 8418de41e05..feb4d46c973 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py @@ -13,7 +13,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, List, Optional + from typing import Any, Dict, List, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -147,7 +150,7 @@ def build_put_empty_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -235,7 +238,7 @@ def build_put_boolean_tfft_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -401,7 +404,7 @@ def build_put_integer_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -567,7 +570,7 @@ def build_put_long_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -733,7 +736,7 @@ def build_put_float_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -899,7 +902,7 @@ def build_put_double_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1065,7 +1068,7 @@ def build_put_string_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1153,7 +1156,7 @@ def build_put_enum_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1241,7 +1244,7 @@ def build_put_string_enum_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1409,7 +1412,7 @@ def build_put_uuid_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1536,7 +1539,7 @@ def build_put_date_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1704,7 +1707,7 @@ def build_put_date_time_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1872,7 +1875,7 @@ def build_put_date_time_rfc1123_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1960,7 +1963,7 @@ def build_put_duration_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2050,7 +2053,7 @@ def build_put_byte_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2392,7 +2395,7 @@ def build_put_complex_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2649,7 +2652,7 @@ def build_put_array_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2909,7 +2912,7 @@ def build_put_dictionary_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py index 50252b95239..082ccbb614a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -107,7 +110,7 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value empty []. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -115,7 +118,7 @@ def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -179,7 +182,7 @@ def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_boolean_tfft_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_boolean_tfft_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value empty [true, false, false, true]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -187,7 +190,7 @@ def build_put_boolean_tfft_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -313,7 +316,7 @@ def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_integer_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_integer_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -321,7 +324,7 @@ def build_put_integer_valid_request(*, json: Any = None, content: Any = None, ** :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -447,7 +450,7 @@ def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_long_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_long_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -455,7 +458,7 @@ def build_put_long_valid_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -581,7 +584,7 @@ def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_float_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_float_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -589,7 +592,7 @@ def build_put_float_valid_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -715,7 +718,7 @@ def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_double_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_double_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -723,7 +726,7 @@ def build_put_double_valid_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -849,7 +852,7 @@ def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_string_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -857,7 +860,7 @@ def build_put_string_valid_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -921,7 +924,7 @@ def build_get_enum_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_enum_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_enum_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -929,7 +932,7 @@ def build_put_enum_valid_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -993,7 +996,7 @@ def build_get_string_enum_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_string_enum_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_enum_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1001,7 +1004,7 @@ def build_put_string_enum_valid_request(*, json: Any = None, content: Any = None :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1128,7 +1131,7 @@ def build_get_uuid_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_uuid_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_uuid_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1137,7 +1140,7 @@ def build_put_uuid_valid_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1232,7 +1235,7 @@ def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1240,7 +1243,7 @@ def build_put_date_valid_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1367,7 +1370,7 @@ def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1376,7 +1379,7 @@ def build_put_date_time_valid_request(*, json: Any = None, content: Any = None, :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1503,7 +1506,9 @@ def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_rfc1123_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_rfc1123_valid_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1512,7 +1517,7 @@ def build_put_date_time_rfc1123_valid_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1576,7 +1581,7 @@ def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_duration_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_duration_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1584,7 +1589,7 @@ def build_put_duration_valid_request(*, json: Any = None, content: Any = None, * :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1649,7 +1654,7 @@ def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_byte_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_byte_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -1658,7 +1663,7 @@ def build_put_byte_valid_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1927,7 +1932,7 @@ def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_complex_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_complex_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -1936,7 +1941,7 @@ def build_put_complex_valid_request(*, json: Any = None, content: Any = None, ** :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2137,7 +2142,7 @@ def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_array_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_array_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2145,7 +2150,7 @@ def build_put_array_valid_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2348,7 +2353,7 @@ def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_dictionary_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_dictionary_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2357,7 +2362,7 @@ def build_put_dictionary_valid_request(*, json: Any = None, content: Any = None, :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py index b2240312220..f2081da2914 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, IO, Optional + from typing import Any, IO, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -29,7 +32,7 @@ def build_file_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. JSON file with payload { "more": "cowbell" }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). JSON file with payload { "more": "cowbell" }. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py index 164ea2b1662..095e7c44662 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py @@ -5,15 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Optional +from typing import Any, IO, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_file_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_file_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Uploading json file. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -21,7 +24,7 @@ def build_file_request(*, json: Any = None, content: Any = None, **kwargs: Any) :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. JSON file with payload { "more": "cowbell" }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). JSON file with payload { "more": "cowbell" }. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py index c5a2a49c9b6..b5ab4bf8e13 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py index 102cf4b1250..5cdd507dac2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py index 3eaee5fef8b..b7a1450d2fd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -123,7 +126,7 @@ def build_put_non_ascii_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py index d578c2f122b..2905d0161cb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -82,7 +85,7 @@ def build_get_non_ascii_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_non_ascii_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_non_ascii_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -91,7 +94,7 @@ def build_put_non_ascii_request(*, json: Any = None, content: Any = None, **kwar :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py index 7f86e62345a..557e15e21e9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -71,7 +74,7 @@ def build_put_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog". - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog". @@ -164,7 +167,7 @@ def build_put_empty_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put an empty array. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put an empty array. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py index 927016971e1..45d8574549d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -46,7 +49,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with array property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -55,7 +58,7 @@ def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog". - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog". @@ -124,7 +127,7 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with array property which is empty. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -132,7 +135,7 @@ def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put an empty array. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put an empty array. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py index f28eed00312..2855de053da 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -73,7 +76,7 @@ def build_put_valid_request( :paramtype api_version: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put {id: 2, name: 'abc', color: 'Magenta'}. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put {id: 2, name: 'abc', color: 'Magenta'}. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py index 09df5de1670..4f4f2459fe3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -46,7 +49,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Please put {id: 2, name: 'abc', color: 'Magenta'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -57,7 +60,7 @@ def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: :paramtype api_version: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put {id: 2, name: 'abc', color: 'Magenta'}. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put {id: 2, name: 'abc', color: 'Magenta'}. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py index 6a98b3ee4a1..eea32a8441f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -71,7 +74,7 @@ def build_put_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put a dictionary with 5 key-value pairs: "txt":"notepad", "bmp":"mspaint", "xls":"excel", "exe":"", "":null. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put a dictionary with 5 key-value pairs: "txt":"notepad", "bmp":"mspaint", "xls":"excel", "exe":"", "":null. @@ -164,7 +167,7 @@ def build_put_empty_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put an empty dictionary. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put an empty dictionary. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py index c7e975dff4f..2ebe89f0c03 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -46,7 +49,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with dictionary property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -55,7 +58,7 @@ def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put a dictionary with 5 key-value pairs: "txt":"notepad", "bmp":"mspaint", "xls":"excel", "exe":"", "":null. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put a dictionary with 5 key-value pairs: "txt":"notepad", "bmp":"mspaint", "xls":"excel", "exe":"", "":null. @@ -124,7 +127,7 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with dictionary property which is empty. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -132,7 +135,7 @@ def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put an empty dictionary. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put an empty dictionary. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py index 7261ada8dc1..318bd077c02 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py index 38c2ca26071..3f9343081c2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py index 6d6386c1ef0..0c2c572cf0c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -80,7 +83,7 @@ def build_put_valid_request( our example to find the input shape. Please put a siamese with id=2, name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one named "Tomato" with id=-1 and food="french fries". - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put a siamese with id=2, name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py index f8105a80a83..52bee45c2ef 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -54,7 +57,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types that extend others. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -64,7 +67,7 @@ def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: our example to find the input shape. Please put a siamese with id=2, name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one named "Tomato" with id=-1 and food="french fries". - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put a siamese with id=2, name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py index 29a929745de..f7fb82e5653 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -125,7 +128,7 @@ def build_put_valid_request( } ] }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put a salmon that looks like this: { diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py index 93456cf82de..c87b8f18700 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -49,7 +52,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic and have recursive references. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -109,7 +112,7 @@ def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: } ] }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put a salmon that looks like this: { diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py index bd6bf95a158..8d6e331c886 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -105,7 +108,7 @@ def build_put_valid_request( } ] };. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put a salmon that looks like this: { @@ -416,7 +419,7 @@ def build_put_complicated_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -481,7 +484,7 @@ def build_put_missing_discriminator_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -592,7 +595,7 @@ def build_put_valid_missing_required_request( } ] }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please attempt put a sawshark that looks like this, the client should not allow this data to be sent: diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py index af9fd572f52..fc2223165a2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -49,7 +52,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -89,7 +92,7 @@ def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: } ] };. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put a salmon that looks like this: { @@ -351,7 +354,7 @@ def build_get_complicated_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_complicated_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_complicated_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -360,7 +363,7 @@ def build_put_complicated_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -409,7 +412,9 @@ def build_put_complicated_request(*, json: Any = None, content: Any = None, **kw return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_missing_discriminator_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_missing_discriminator_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Put complex types that are polymorphic, omitting the discriminator. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -417,7 +422,7 @@ def build_put_missing_discriminator_request(*, json: Any = None, content: Any = :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -485,7 +490,9 @@ def build_put_missing_discriminator_request(*, json: Any = None, content: Any = return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_valid_missing_required_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_missing_required_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -520,7 +527,7 @@ def build_put_valid_missing_required_request(*, json: Any = None, content: Any = } ] }. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please attempt put a sawshark that looks like this, the client should not allow this data to be sent: diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py index 2e36811a35d..07489b4e029 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -69,7 +72,7 @@ def build_put_int_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put -1 and 2. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put -1 and 2. :paramtype content: any @@ -159,7 +162,7 @@ def build_put_long_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 1099511627775 and -999511627788. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 1099511627775 and -999511627788. :paramtype content: any @@ -249,7 +252,7 @@ def build_put_float_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 1.05 and -0.003. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 1.05 and -0.003. :paramtype content: any @@ -340,7 +343,7 @@ def build_put_double_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 3e-100 and -0.000000000000000000000000000000000000000000000000000000005. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 3e-100 and -0.000000000000000000000000000000000000000000000000000000005. @@ -431,7 +434,7 @@ def build_put_bool_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put true and false. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put true and false. :paramtype content: any @@ -522,7 +525,7 @@ def build_put_string_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 'goodrequest', '', and null. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 'goodrequest', '', and null. :paramtype content: any @@ -613,7 +616,7 @@ def build_put_date_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put '0001-01-01' and '2016-02-29'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put '0001-01-01' and '2016-02-29'. :paramtype content: any @@ -704,7 +707,7 @@ def build_put_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. @@ -796,7 +799,7 @@ def build_put_date_time_rfc1123_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. @@ -886,7 +889,7 @@ def build_put_duration_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 'P123DT22H14M12.011S'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 'P123DT22H14M12.011S'. :paramtype content: any @@ -975,7 +978,7 @@ def build_put_byte_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py index b3e71ebf4e0..545115969b5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -45,7 +48,7 @@ def build_get_int_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_int_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_int_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with integer properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -53,7 +56,7 @@ def build_put_int_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put -1 and 2. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put -1 and 2. :paramtype content: any @@ -119,7 +122,7 @@ def build_get_long_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_long_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_long_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with long properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -127,7 +130,7 @@ def build_put_long_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 1099511627775 and -999511627788. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 1099511627775 and -999511627788. :paramtype content: any @@ -193,7 +196,7 @@ def build_get_float_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_float_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with float properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -201,7 +204,7 @@ def build_put_float_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 1.05 and -0.003. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 1.05 and -0.003. :paramtype content: any @@ -267,7 +270,7 @@ def build_get_double_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_double_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with double properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -276,7 +279,7 @@ def build_put_double_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 3e-100 and -0.000000000000000000000000000000000000000000000000000000005. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 3e-100 and -0.000000000000000000000000000000000000000000000000000000005. @@ -343,7 +346,7 @@ def build_get_bool_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_bool_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_bool_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with bool properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -351,7 +354,7 @@ def build_put_bool_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put true and false. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put true and false. :paramtype content: any @@ -418,7 +421,7 @@ def build_get_string_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_string_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with string properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -426,7 +429,7 @@ def build_put_string_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 'goodrequest', '', and null. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 'goodrequest', '', and null. :paramtype content: any @@ -493,7 +496,7 @@ def build_get_date_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with date properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -501,7 +504,7 @@ def build_put_date_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put '0001-01-01' and '2016-02-29'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put '0001-01-01' and '2016-02-29'. :paramtype content: any @@ -567,7 +570,7 @@ def build_get_date_time_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with datetime properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -576,7 +579,7 @@ def build_put_date_time_request(*, json: Any = None, content: Any = None, **kwar :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. @@ -643,7 +646,7 @@ def build_get_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_rfc1123_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_rfc1123_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with datetimeRfc1123 properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -652,7 +655,7 @@ def build_put_date_time_rfc1123_request(*, json: Any = None, content: Any = None :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. @@ -718,7 +721,7 @@ def build_get_duration_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_duration_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with duration properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -726,7 +729,7 @@ def build_put_duration_request(*, json: Any = None, content: Any = None, **kwarg :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put 'P123DT22H14M12.011S'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put 'P123DT22H14M12.011S'. :paramtype content: any @@ -790,7 +793,7 @@ def build_get_byte_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_byte_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_byte_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types with byte properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -799,7 +802,7 @@ def build_put_byte_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py index 019f477388c..cc3a3358861 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -69,7 +72,7 @@ def build_put_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py index 1e86e6c035c..d8b9a75df9b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -45,7 +48,7 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put complex types that have readonly properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -53,7 +56,7 @@ def build_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py index 1781d4d8086..6de34fe8b57 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py @@ -13,7 +13,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -154,7 +157,7 @@ def build_put_max_date_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. date body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). date body. :paramtype content: any @@ -232,7 +235,7 @@ def build_put_min_date_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. date body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). date body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py index 435d8b3f0d8..ffe4babf318 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -106,7 +109,7 @@ def build_get_underflow_date_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_max_date_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_max_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put max date value 9999-12-31. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -114,7 +117,7 @@ def build_put_max_date_request(*, json: Any = None, content: Any = None, **kwarg :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. date body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). date body. :paramtype content: any @@ -168,7 +171,7 @@ def build_get_max_date_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_min_date_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_min_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put min date value 0000-01-01. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -176,7 +179,7 @@ def build_put_min_date_request(*, json: Any = None, content: Any = None, **kwarg :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. date body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). date body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py index 9977f73111a..458023295d7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py @@ -13,7 +13,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -154,7 +157,7 @@ def build_put_utc_max_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -204,7 +207,7 @@ def build_put_utc_max_date_time7_digits_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -347,7 +350,7 @@ def build_put_local_positive_offset_max_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -456,7 +459,7 @@ def build_put_local_negative_offset_max_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -565,7 +568,7 @@ def build_put_utc_min_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -643,7 +646,7 @@ def build_put_local_positive_offset_min_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -721,7 +724,7 @@ def build_put_local_negative_offset_min_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py index 6365dfdc016..44ee6821fff 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -106,7 +109,7 @@ def build_get_underflow_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_utc_max_date_time_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_utc_max_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put max datetime value 9999-12-31T23:59:59.999Z. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -114,7 +117,7 @@ def build_put_utc_max_date_time_request(*, json: Any = None, content: Any = None :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -145,7 +148,9 @@ def build_put_utc_max_date_time_request(*, json: Any = None, content: Any = None return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_utc_max_date_time7_digits_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_utc_max_date_time7_digits_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Put max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -156,7 +161,7 @@ def build_put_utc_max_date_time7_digits_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -260,7 +265,7 @@ def build_get_utc_uppercase_max_date_time7_digits_request(**kwargs: Any) -> Http def build_put_local_positive_offset_max_date_time_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00. @@ -269,7 +274,7 @@ def build_put_local_positive_offset_max_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -347,7 +352,7 @@ def build_get_local_positive_offset_uppercase_max_date_time_request(**kwargs: An def build_put_local_negative_offset_max_date_time_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00. @@ -356,7 +361,7 @@ def build_put_local_negative_offset_max_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -433,7 +438,7 @@ def build_get_local_negative_offset_lowercase_max_date_time_request(**kwargs: An return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_utc_min_date_time_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_utc_min_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put min datetime value 0001-01-01T00:00:00Z. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -441,7 +446,7 @@ def build_put_utc_min_date_time_request(*, json: Any = None, content: Any = None :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -496,7 +501,7 @@ def build_get_utc_min_date_time_request(**kwargs: Any) -> HttpRequest: def build_put_local_positive_offset_min_date_time_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Put min datetime value 0001-01-01T00:00:00+14:00. @@ -505,7 +510,7 @@ def build_put_local_positive_offset_min_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -560,7 +565,7 @@ def build_get_local_positive_offset_min_date_time_request(**kwargs: Any) -> Http def build_put_local_negative_offset_min_date_time_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Put min datetime value 0001-01-01T00:00:00-14:00. @@ -569,7 +574,7 @@ def build_put_local_negative_offset_min_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py index 4e4946f2b97..97d8261c475 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py @@ -13,7 +13,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -154,7 +157,7 @@ def build_put_utc_max_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -263,7 +266,7 @@ def build_put_utc_min_date_time_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py index 021401aaed9..7c1c5e56787 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -106,7 +109,7 @@ def build_get_underflow_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_utc_max_date_time_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_utc_max_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -114,7 +117,7 @@ def build_put_utc_max_date_time_request(*, json: Any = None, content: Any = None :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any @@ -191,7 +194,7 @@ def build_get_utc_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_utc_min_date_time_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_utc_min_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -199,7 +202,7 @@ def build_put_utc_min_date_time_request(*, json: Any = None, content: Any = None :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. datetime body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). datetime body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py index b7ca69757bd..04a733f6ee2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py @@ -13,7 +13,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, List, Optional + from typing import Any, Dict, List, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -108,7 +111,7 @@ def build_put_empty_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -352,7 +355,7 @@ def build_put_boolean_tfft_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -518,7 +521,7 @@ def build_put_integer_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -684,7 +687,7 @@ def build_put_long_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -850,7 +853,7 @@ def build_put_float_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1016,7 +1019,7 @@ def build_put_double_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1182,7 +1185,7 @@ def build_put_string_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1348,7 +1351,7 @@ def build_put_date_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1516,7 +1519,7 @@ def build_put_date_time_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1684,7 +1687,7 @@ def build_put_date_time_rfc1123_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1772,7 +1775,7 @@ def build_put_duration_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1862,7 +1865,7 @@ def build_put_byte_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2205,7 +2208,7 @@ def build_put_complex_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2464,7 +2467,7 @@ def build_put_array_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2726,7 +2729,7 @@ def build_put_dictionary_valid_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py index 393e9cd7268..b5e64cfcebc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -76,7 +79,7 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value empty {}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -84,7 +87,7 @@ def build_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -272,7 +275,7 @@ def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_boolean_tfft_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_boolean_tfft_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -280,7 +283,7 @@ def build_put_boolean_tfft_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -406,7 +409,7 @@ def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_integer_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_integer_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -414,7 +417,7 @@ def build_put_integer_valid_request(*, json: Any = None, content: Any = None, ** :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -540,7 +543,7 @@ def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_long_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_long_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -548,7 +551,7 @@ def build_put_long_valid_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -674,7 +677,7 @@ def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_float_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_float_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -682,7 +685,7 @@ def build_put_float_valid_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -808,7 +811,7 @@ def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_double_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_double_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -816,7 +819,7 @@ def build_put_double_valid_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -942,7 +945,7 @@ def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_string_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -950,7 +953,7 @@ def build_put_string_valid_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1076,7 +1079,7 @@ def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1084,7 +1087,7 @@ def build_put_date_valid_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1211,7 +1214,7 @@ def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1220,7 +1223,7 @@ def build_put_date_time_valid_request(*, json: Any = None, content: Any = None, :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1347,7 +1350,9 @@ def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_date_time_rfc1123_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_rfc1123_valid_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1356,7 +1361,7 @@ def build_put_date_time_rfc1123_valid_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1420,7 +1425,7 @@ def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_duration_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_duration_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1428,7 +1433,7 @@ def build_put_duration_valid_request(*, json: Any = None, content: Any = None, * :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1493,7 +1498,7 @@ def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_byte_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_byte_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each elementencoded in base 64. @@ -1502,7 +1507,7 @@ def build_put_byte_valid_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1772,7 +1777,7 @@ def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_complex_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_complex_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -1781,7 +1786,7 @@ def build_put_complex_valid_request(*, json: Any = None, content: Any = None, ** :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1983,7 +1988,7 @@ def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_array_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_array_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -1992,7 +1997,7 @@ def build_put_array_valid_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -2196,7 +2201,7 @@ def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_dictionary_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_dictionary_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2206,7 +2211,7 @@ def build_put_dictionary_valid_request(*, json: Any = None, content: Any = None, :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py index 37197f9661c..a68dea956c3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py @@ -13,7 +13,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -61,7 +64,7 @@ def build_put_positive_duration_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. duration body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). duration body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py index 5a83c6b9493..89c30611e30 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -37,7 +40,7 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_positive_duration_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_positive_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put a positive duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -45,7 +48,7 @@ def build_put_positive_duration_request(*, json: Any = None, content: Any = None :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. duration body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). duration body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py index 8885305e4e4..1f91398c368 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, IO, List, Optional + from typing import Any, Dict, IO, List, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py index 2403ccbb9a4..c7c763dd6c1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, IO, List, Optional +from typing import Any, Dict, IO, List, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py index 74ec1c95648..47460d6f792 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py index e070852dfba..4131f9474a9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py @@ -5,13 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from ..._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py index 2d1c559fd6b..c36b34cc695 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py @@ -13,7 +13,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -216,7 +219,7 @@ def build_put_max32_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any @@ -263,7 +266,7 @@ def build_put_max64_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any @@ -310,7 +313,7 @@ def build_put_min32_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any @@ -357,7 +360,7 @@ def build_put_min64_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any @@ -435,7 +438,7 @@ def build_put_unix_time_date_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py index 83f0e22136b..701ee2aa295 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -152,7 +155,7 @@ def build_get_underflow_int64_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_max32_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_max32_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put max int32 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -160,7 +163,7 @@ def build_put_max32_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any @@ -191,7 +194,7 @@ def build_put_max32_request(*, json: Any = None, content: Any = None, **kwargs: return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_max64_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_max64_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put max int64 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -199,7 +202,7 @@ def build_put_max64_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any @@ -230,7 +233,7 @@ def build_put_max64_request(*, json: Any = None, content: Any = None, **kwargs: return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_min32_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_min32_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put min int32 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -238,7 +241,7 @@ def build_put_min32_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any @@ -269,7 +272,7 @@ def build_put_min32_request(*, json: Any = None, content: Any = None, **kwargs: return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_min64_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_min64_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put min int64 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -277,7 +280,7 @@ def build_put_min64_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any @@ -331,7 +334,7 @@ def build_get_unix_time_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_unix_time_date_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_unix_time_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put datetime encoded as Unix time. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -339,7 +342,7 @@ def build_put_unix_time_date_request(*, json: Any = None, content: Any = None, * :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. int body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). int body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py index f17a4dbfb90..dd0d86aa399 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -153,7 +156,7 @@ def build_put_big_float_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -231,7 +234,7 @@ def build_put_big_double_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -451,7 +454,7 @@ def build_put_big_decimal_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -671,7 +674,7 @@ def build_put_small_float_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -749,7 +752,7 @@ def build_put_small_double_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -827,7 +830,7 @@ def build_put_small_decimal_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py index a95898e1a84..e3185941e54 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -105,7 +108,7 @@ def build_get_invalid_decimal_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_big_float_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_big_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put big float value 3.402823e+20. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -113,7 +116,7 @@ def build_put_big_float_request(*, json: Any = None, content: Any = None, **kwar :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -167,7 +170,7 @@ def build_get_big_float_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_big_double_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_big_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put big double value 2.5976931e+101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -175,7 +178,7 @@ def build_put_big_double_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -337,7 +340,7 @@ def build_get_big_double_negative_decimal_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_big_decimal_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_big_decimal_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put big decimal value 2.5976931e+101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -345,7 +348,7 @@ def build_put_big_decimal_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -507,7 +510,7 @@ def build_get_big_decimal_negative_decimal_request(**kwargs: Any) -> HttpRequest return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_small_float_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_small_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put small float value 3.402823e-20. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -515,7 +518,7 @@ def build_put_small_float_request(*, json: Any = None, content: Any = None, **kw :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -569,7 +572,7 @@ def build_get_small_float_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_small_double_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_small_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put small double value 2.5976931e-101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -577,7 +580,7 @@ def build_put_small_double_request(*, json: Any = None, content: Any = None, **k :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any @@ -631,7 +634,7 @@ def build_get_small_double_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_small_decimal_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_small_decimal_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put small decimal value 2.5976931e-101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -639,7 +642,7 @@ def build_put_small_decimal_request(*, json: Any = None, content: Any = None, ** :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. number body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). number body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py index 9cabc325d10..284d15ea9eb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -66,7 +69,7 @@ def build_put_not_expandable_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). string body. :paramtype content: any @@ -150,7 +153,7 @@ def build_put_referenced_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. enum string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). enum string body. :paramtype content: any @@ -237,7 +240,7 @@ def build_put_referenced_constant_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. enum string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). enum string body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py index a02e730d5fe..d04cb3d9a4a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -42,7 +45,7 @@ def build_get_not_expandable_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_not_expandable_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_not_expandable_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -50,7 +53,7 @@ def build_put_not_expandable_request(*, json: Any = None, content: Any = None, * :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). string body. :paramtype content: any @@ -110,7 +113,7 @@ def build_get_referenced_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_referenced_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_referenced_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -118,7 +121,7 @@ def build_put_referenced_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. enum string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). enum string body. :paramtype content: any @@ -181,7 +184,7 @@ def build_get_referenced_constant_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_referenced_constant_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_referenced_constant_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Sends value 'green-color' from a constant. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -189,7 +192,7 @@ def build_put_referenced_constant_request(*, json: Any = None, content: Any = No :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. enum string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). enum string body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py index da71c6fbba7..1a010a2da42 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -60,7 +63,7 @@ def build_put_null_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). string body. :paramtype content: any @@ -419,7 +422,7 @@ def build_put_base64_url_encoded_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). string body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py index f6ab134b9e8..86f88cea241 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -36,7 +39,7 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_null_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_null_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Set string value null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -44,7 +47,7 @@ def build_put_null_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). string body. :paramtype content: any @@ -314,7 +317,7 @@ def build_get_base64_url_encoded_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_base64_url_encoded_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_base64_url_encoded_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put value that is base64url encoded. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -322,7 +325,7 @@ def build_put_base64_url_encoded_request(*, json: Any = None, content: Any = Non :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. string body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). string body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py index 3ba6b630a91..b5875df7af8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py @@ -13,7 +13,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -61,7 +64,7 @@ def build_put_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put time value "08:07:56" in parameter to pass testserver. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put time value "08:07:56" in parameter to pass testserver. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py index 011c545d863..566fdf4cb4d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py @@ -6,11 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -37,7 +40,7 @@ def build_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put time value "08:07:56". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -45,7 +48,7 @@ def build_put_request(*, json: Any = None, content: Any = None, **kwargs: Any) - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put time value "08:07:56" in parameter to pass testserver. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put time value "08:07:56" in parameter to pass testserver. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py index 635e40831bf..6cf720a08a4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -80,7 +83,7 @@ def build_add_pet_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. pet param. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). pet param. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py index 3160b7fc533..cf7fafeba0d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py @@ -5,13 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from ..._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -55,7 +58,7 @@ def build_get_by_pet_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_add_pet_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_add_pet_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """add pet. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -63,7 +66,7 @@ def build_add_pet_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. pet param. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). pet param. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py index 6faae3fdeb4..bd15e1b02fa 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -122,7 +125,7 @@ def build_put400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -169,7 +172,7 @@ def build_patch400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -216,7 +219,7 @@ def build_post400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -263,7 +266,7 @@ def build_delete400_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -434,7 +437,7 @@ def build_put404_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -481,7 +484,7 @@ def build_patch405_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -528,7 +531,7 @@ def build_post406_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -575,7 +578,7 @@ def build_delete407_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -622,7 +625,7 @@ def build_put409_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -793,7 +796,7 @@ def build_put413_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -840,7 +843,7 @@ def build_patch414_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -887,7 +890,7 @@ def build_post415_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -965,7 +968,7 @@ def build_delete417_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py index f9bbce71729..778d14cedce 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -82,7 +85,7 @@ def build_options400_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) -def build_put400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -90,7 +93,7 @@ def build_put400_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -121,7 +124,7 @@ def build_put400_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_patch400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -129,7 +132,7 @@ def build_patch400_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -160,7 +163,7 @@ def build_patch400_request(*, json: Any = None, content: Any = None, **kwargs: A return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -168,7 +171,7 @@ def build_post400_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -199,7 +202,7 @@ def build_post400_request(*, json: Any = None, content: Any = None, **kwargs: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_delete400_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_delete400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -207,7 +210,7 @@ def build_delete400_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -330,7 +333,7 @@ def build_get403_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put404_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put404_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 404 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -338,7 +341,7 @@ def build_put404_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -369,7 +372,7 @@ def build_put404_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_patch405_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch405_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 405 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -377,7 +380,7 @@ def build_patch405_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -408,7 +411,7 @@ def build_patch405_request(*, json: Any = None, content: Any = None, **kwargs: A return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post406_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post406_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 406 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -416,7 +419,7 @@ def build_post406_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -447,7 +450,7 @@ def build_post406_request(*, json: Any = None, content: Any = None, **kwargs: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_delete407_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_delete407_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 407 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -455,7 +458,7 @@ def build_delete407_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -486,7 +489,7 @@ def build_delete407_request(*, json: Any = None, content: Any = None, **kwargs: return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put409_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put409_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 409 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -494,7 +497,7 @@ def build_put409_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -617,7 +620,7 @@ def build_get412_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put413_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put413_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 413 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -625,7 +628,7 @@ def build_put413_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -656,7 +659,7 @@ def build_put413_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_patch414_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch414_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 414 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -664,7 +667,7 @@ def build_patch414_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -695,7 +698,7 @@ def build_patch414_request(*, json: Any = None, content: Any = None, **kwargs: A return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post415_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post415_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 415 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -703,7 +706,7 @@ def build_post415_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -757,7 +760,7 @@ def build_get416_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_delete417_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_delete417_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 417 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -765,7 +768,7 @@ def build_delete417_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py index 37537fc261e..1671758776d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py index d08e3bc8822..f3bdfc64466 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py index c42fdf8b5a9..0f29cda745c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -162,7 +165,7 @@ def build_put301_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -272,7 +275,7 @@ def build_patch302_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -320,7 +323,7 @@ def build_post303_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -460,7 +463,7 @@ def build_put307_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -507,7 +510,7 @@ def build_patch307_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -554,7 +557,7 @@ def build_post307_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -601,7 +604,7 @@ def build_delete307_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py index 1338df00810..879d9009538 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -113,7 +116,7 @@ def build_get301_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put301_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put301_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put true Boolean value in request returns 301. This request should not be automatically redirected, but should return the received 301 to the caller for evaluation. @@ -122,7 +125,7 @@ def build_put301_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -199,7 +202,7 @@ def build_get302_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_patch302_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch302_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation. @@ -208,7 +211,7 @@ def build_patch302_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -239,7 +242,7 @@ def build_patch302_request(*, json: Any = None, content: Any = None, **kwargs: A return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post303_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post303_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Post true Boolean value in request returns 303. This request should be automatically redirected usign a get, ultimately returning a 200 status code. @@ -248,7 +251,7 @@ def build_post303_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -348,7 +351,7 @@ def build_options307_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) -def build_put307_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -356,7 +359,7 @@ def build_put307_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -387,7 +390,7 @@ def build_put307_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_patch307_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Patch redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -395,7 +398,7 @@ def build_patch307_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -426,7 +429,7 @@ def build_patch307_request(*, json: Any = None, content: Any = None, **kwargs: A return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post307_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Post redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -434,7 +437,7 @@ def build_post307_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -465,7 +468,7 @@ def build_post307_request(*, json: Any = None, content: Any = None, **kwargs: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_delete307_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_delete307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Delete redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -473,7 +476,7 @@ def build_delete307_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py index 8f349a15c9a..7e3e09d8a9f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -60,7 +63,7 @@ def build_put500_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -107,7 +110,7 @@ def build_patch500_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -216,7 +219,7 @@ def build_post503_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -263,7 +266,7 @@ def build_delete503_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -310,7 +313,7 @@ def build_put504_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -357,7 +360,7 @@ def build_patch504_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py index df1eed70570..5bf559365ff 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -36,7 +39,7 @@ def build_head408_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) -def build_put500_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put500_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 500 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -44,7 +47,7 @@ def build_put500_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -75,7 +78,7 @@ def build_put500_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_patch500_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch500_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 500 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -83,7 +86,7 @@ def build_patch500_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -160,7 +163,7 @@ def build_options502_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) -def build_post503_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post503_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 503 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -168,7 +171,7 @@ def build_post503_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -199,7 +202,7 @@ def build_post503_request(*, json: Any = None, content: Any = None, **kwargs: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_delete503_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_delete503_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 503 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -207,7 +210,7 @@ def build_delete503_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -238,7 +241,7 @@ def build_delete503_request(*, json: Any = None, content: Any = None, **kwargs: return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put504_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put504_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 504 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -246,7 +249,7 @@ def build_put504_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -277,7 +280,7 @@ def build_put504_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_patch504_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch504_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 504 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -285,7 +288,7 @@ def build_patch504_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py index ff358e4e9dd..37b14ba9cb0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -91,7 +94,7 @@ def build_post505_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -138,7 +141,7 @@ def build_delete505_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py index 416f9b03f35..d480e234ce3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -59,7 +62,7 @@ def build_get501_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_post505_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post505_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 505 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -67,7 +70,7 @@ def build_post505_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -98,7 +101,7 @@ def build_post505_request(*, json: Any = None, content: Any = None, **kwargs: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_delete505_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_delete505_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Return 505 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -106,7 +109,7 @@ def build_delete505_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py index 2e6d5c9f70b..e11611a2848 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -122,7 +125,7 @@ def build_put200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -169,7 +172,7 @@ def build_patch200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -216,7 +219,7 @@ def build_post200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -263,7 +266,7 @@ def build_delete200_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -310,7 +313,7 @@ def build_put201_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -357,7 +360,7 @@ def build_post201_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -404,7 +407,7 @@ def build_put202_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -451,7 +454,7 @@ def build_patch202_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -498,7 +501,7 @@ def build_post202_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -545,7 +548,7 @@ def build_delete202_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -623,7 +626,7 @@ def build_put204_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -670,7 +673,7 @@ def build_patch204_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -717,7 +720,7 @@ def build_post204_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -764,7 +767,7 @@ def build_delete204_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py index 160b3c1bf1a..81e2f2ecb6a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -82,7 +85,7 @@ def build_options200_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) -def build_put200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put boolean value true returning 200 success. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -90,7 +93,7 @@ def build_put200_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -121,7 +124,7 @@ def build_put200_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_patch200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Patch true Boolean value in request returning 200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -129,7 +132,7 @@ def build_patch200_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -160,7 +163,7 @@ def build_patch200_request(*, json: Any = None, content: Any = None, **kwargs: A return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Post bollean value true in request that returns a 200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -168,7 +171,7 @@ def build_post200_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -199,7 +202,7 @@ def build_post200_request(*, json: Any = None, content: Any = None, **kwargs: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_delete200_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_delete200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Delete simple boolean value true returns 200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -207,7 +210,7 @@ def build_delete200_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -238,7 +241,7 @@ def build_delete200_request(*, json: Any = None, content: Any = None, **kwargs: return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put201_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put201_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put true Boolean value in request returns 201. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -246,7 +249,7 @@ def build_put201_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -277,7 +280,7 @@ def build_put201_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post201_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post201_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Post true Boolean value in request returns 201 (Created). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -285,7 +288,7 @@ def build_post201_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -316,7 +319,7 @@ def build_post201_request(*, json: Any = None, content: Any = None, **kwargs: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put202_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put true Boolean value in request returns 202 (Accepted). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -324,7 +327,7 @@ def build_put202_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -355,7 +358,7 @@ def build_put202_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_patch202_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Patch true Boolean value in request returns 202. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -363,7 +366,7 @@ def build_patch202_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -394,7 +397,7 @@ def build_patch202_request(*, json: Any = None, content: Any = None, **kwargs: A return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post202_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Post true Boolean value in request returns 202 (Accepted). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -402,7 +405,7 @@ def build_post202_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -433,7 +436,7 @@ def build_post202_request(*, json: Any = None, content: Any = None, **kwargs: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_delete202_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_delete202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Delete true Boolean value in request returns 202 (accepted). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -441,7 +444,7 @@ def build_delete202_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -495,7 +498,7 @@ def build_head204_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) -def build_put204_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -503,7 +506,7 @@ def build_put204_request(*, json: Any = None, content: Any = None, **kwargs: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -534,7 +537,7 @@ def build_put204_request(*, json: Any = None, content: Any = None, **kwargs: Any return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_patch204_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Patch true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -542,7 +545,7 @@ def build_patch204_request(*, json: Any = None, content: Any = None, **kwargs: A :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -573,7 +576,7 @@ def build_patch204_request(*, json: Any = None, content: Any = None, **kwargs: A return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post204_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Post true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -581,7 +584,7 @@ def build_post204_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any @@ -612,7 +615,7 @@ def build_post204_request(*, json: Any = None, content: Any = None, **kwargs: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_delete204_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_delete204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Delete true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -620,7 +623,7 @@ def build_delete204_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple boolean value true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple boolean value true. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py index b80837d5b08..5663cc78a8e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py index 599f5b97800..73826f8c09a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py index 95a069699c1..9b62d4d8cde 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, IO, Optional, Union + from typing import Any, IO, Optional, TypeVar, Union + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -29,7 +32,7 @@ def build_analyze_body_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Input parameter. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Input parameter. :paramtype content: any @@ -80,7 +83,7 @@ def build_analyze_body_no_accept_header_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Input parameter. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Input parameter. :paramtype content: any @@ -167,7 +170,7 @@ def build_binary_body_with_two_content_types_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The payload body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The payload body. :paramtype content: any @@ -216,7 +219,7 @@ def build_binary_body_with_three_content_types_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The payload body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The payload body. :paramtype content: any @@ -266,7 +269,7 @@ def build_put_text_and_json_body_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The payload body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The payload body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py index cb01fbf60dd..e37fe8d21bd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py @@ -5,15 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Optional, Union +from typing import Any, IO, Optional, TypeVar, Union from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_analyze_body_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_analyze_body_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Analyze body, that could be different media types. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -21,7 +24,7 @@ def build_analyze_body_request(*, json: Any = None, content: Any = None, **kwarg :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Input parameter. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Input parameter. :paramtype content: any @@ -55,7 +58,9 @@ def build_analyze_body_request(*, json: Any = None, content: Any = None, **kwarg return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_analyze_body_no_accept_header_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_analyze_body_no_accept_header_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type. @@ -64,7 +69,7 @@ def build_analyze_body_no_accept_header_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Input parameter. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Input parameter. :paramtype content: any @@ -127,7 +132,7 @@ def build_content_type_with_encoding_request(*, content: Any = None, **kwargs: A def build_binary_body_with_two_content_types_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Binary body with two content types. Pass in of {'hello': 'world'} for the application/json content type, and a byte stream of 'hello, world!' for application/octet-stream. @@ -137,7 +142,7 @@ def build_binary_body_with_two_content_types_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The payload body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The payload body. :paramtype content: any @@ -169,7 +174,7 @@ def build_binary_body_with_two_content_types_request( def build_binary_body_with_three_content_types_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Binary body with three content types. Pass in string 'hello, world' with content type 'text/plain', {'hello': world'} with content type 'application/json' and a byte string for @@ -180,7 +185,7 @@ def build_binary_body_with_three_content_types_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The payload body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The payload body. :paramtype content: any @@ -214,7 +219,7 @@ def build_binary_body_with_three_content_types_request( return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_put_text_and_json_body_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_text_and_json_body_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Body that's either text/plain or application/json. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -222,7 +227,7 @@ def build_put_text_and_json_body_request(*, json: Any = None, content: Any = Non :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The payload body. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The payload body. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py index a20db2eafcb..2d34734d2f9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, List, Optional + from typing import Any, Dict, List, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -31,7 +34,7 @@ def build_put_array_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. External Resource as an Array to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). External Resource as an Array to put. :paramtype content: any @@ -142,7 +145,7 @@ def build_put_wrapped_array_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. External Resource as an Array to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). External Resource as an Array to put. :paramtype content: any @@ -237,7 +240,7 @@ def build_put_dictionary_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. External Resource as a Dictionary to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). External Resource as a Dictionary to put. :paramtype content: any @@ -353,7 +356,7 @@ def build_put_resource_collection_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. External Resource as a ResourceCollection to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). External Resource as a ResourceCollection to put. :paramtype content: any @@ -537,7 +540,7 @@ def build_put_simple_product_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple body product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple body product to put. :paramtype content: any @@ -609,7 +612,7 @@ def build_post_flattened_simple_product_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple body product to post. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple body product to post. :paramtype content: any @@ -684,7 +687,7 @@ def build_put_simple_product_with_grouping_request( :type name: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple body product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple body product to put. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py index e819071e84a..33262169632 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py @@ -5,17 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from .._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_put_array_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_array_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put External Resource as an Array. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -23,7 +26,7 @@ def build_put_array_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. External Resource as an Array to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). External Resource as an Array to put. :paramtype content: any @@ -109,7 +112,7 @@ def build_get_array_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_wrapped_array_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_wrapped_array_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -118,7 +121,7 @@ def build_put_wrapped_array_request(*, json: Any = None, content: Any = None, ** :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. External Resource as an Array to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). External Resource as an Array to put. :paramtype content: any @@ -189,7 +192,7 @@ def build_get_wrapped_array_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_dictionary_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_dictionary_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put External Resource as a Dictionary. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -197,7 +200,7 @@ def build_put_dictionary_request(*, json: Any = None, content: Any = None, **kwa :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. External Resource as a Dictionary to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). External Resource as a Dictionary to put. :paramtype content: any @@ -289,7 +292,7 @@ def build_get_dictionary_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_resource_collection_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_resource_collection_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put External Resource as a ResourceCollection. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -297,7 +300,7 @@ def build_put_resource_collection_request(*, json: Any = None, content: Any = No :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. External Resource as a ResourceCollection to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). External Resource as a ResourceCollection to put. :paramtype content: any @@ -457,7 +460,7 @@ def build_get_resource_collection_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_simple_product_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_simple_product_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put Simple Product with client flattening true on the model. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -465,7 +468,7 @@ def build_put_simple_product_request(*, json: Any = None, content: Any = None, * :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple body product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple body product to put. :paramtype content: any @@ -521,7 +524,9 @@ def build_put_simple_product_request(*, json: Any = None, content: Any = None, * return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_flattened_simple_product_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_flattened_simple_product_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Put Flattened Simple Product with client flattening true on the parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -529,7 +534,7 @@ def build_post_flattened_simple_product_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple body product to post. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple body product to post. :paramtype content: any @@ -586,7 +591,7 @@ def build_post_flattened_simple_product_request(*, json: Any = None, content: An def build_put_simple_product_with_grouping_request( - name: str, *, json: Any = None, content: Any = None, **kwargs: Any + name: str, *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Put Simple Product with client flattening true on the model. @@ -597,7 +602,7 @@ def build_put_simple_product_with_grouping_request( :type name: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Simple body product to put. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Simple body product to put. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py index 3119a50f200..75d025f881a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -69,7 +72,7 @@ def build_put_horse_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a horse with name 'General' and isAShowHorse false. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a horse with name 'General' and isAShowHorse false. :paramtype content: any @@ -158,7 +161,7 @@ def build_put_pet_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a pet with name 'Butter'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a pet with name 'Butter'. :paramtype content: any @@ -247,7 +250,7 @@ def build_put_feline_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a feline who hisses and doesn't meow. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a feline who hisses and doesn't meow. :paramtype content: any @@ -340,7 +343,7 @@ def build_put_cat_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. @@ -439,7 +442,7 @@ def build_put_kitten_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py index f532a8bfc50..f2f25b42a3d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -45,7 +48,7 @@ def build_get_horse_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_horse_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_horse_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put a horse with name 'General' and isAShowHorse false. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -53,7 +56,7 @@ def build_put_horse_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a horse with name 'General' and isAShowHorse false. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a horse with name 'General' and isAShowHorse false. :paramtype content: any @@ -118,7 +121,7 @@ def build_get_pet_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_pet_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_pet_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put a pet with name 'Butter'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -126,7 +129,7 @@ def build_put_pet_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a pet with name 'Butter'. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a pet with name 'Butter'. :paramtype content: any @@ -191,7 +194,7 @@ def build_get_feline_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_feline_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_feline_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put a feline who hisses and doesn't meow. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -199,7 +202,7 @@ def build_put_feline_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a feline who hisses and doesn't meow. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a feline who hisses and doesn't meow. :paramtype content: any @@ -267,7 +270,7 @@ def build_get_cat_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_cat_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_cat_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -276,7 +279,7 @@ def build_put_cat_request(*, json: Any = None, content: Any = None, **kwargs: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. @@ -349,7 +352,7 @@ def build_get_kitten_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_kitten_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_kitten_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. @@ -359,7 +362,7 @@ def build_put_kitten_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py index 358cdeebe28..10fdb713aa3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -29,7 +32,7 @@ def build_put_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Input float enum. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Input float enum. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py index 74ad74d725e..c6dadc99924 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py @@ -5,15 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_put_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put a float enum. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -21,7 +24,7 @@ def build_put_request(*, json: Any = None, content: Any = None, **kwargs: Any) - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Input float enum. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Input float enum. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py index bcd1b044500..cc290d6a42d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -29,7 +32,7 @@ def build_put_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Input int enum. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Input int enum. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py index e758486fd19..05b23fc0b20 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py @@ -5,15 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() -def build_put_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Put an int enum. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -21,7 +24,7 @@ def build_put_request(*, json: Any = None, content: Any = None, **kwargs: Any) - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Input int enum. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Input int enum. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py index a0ac3a6c96a..d90c20f56fc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -63,7 +66,7 @@ def build_put_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Pass in {'foo': 'bar'} for a 200, anything else for an object error. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Pass in {'foo': 'bar'} for a 200, anything else for an object error. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py index f60f22de4a4..4b79df222bc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -37,7 +40,7 @@ def build_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_put_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Basic put that puts an object. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -47,7 +50,7 @@ def build_put_request(*, json: Any = None, content: Any = None, **kwargs: Any) - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. Pass in {'foo': 'bar'} for a 200, anything else for an object error. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). Pass in {'foo': 'bar'} for a 200, anything else for an object error. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py index f38958d8a62..bd8108d795b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -37,7 +40,7 @@ def build_update_request( :type avset: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The tags. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The tags. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py index da2998bbba4..246cc84673f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py @@ -5,18 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from ..._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() def build_update_request( - resource_group_name: str, avset: str, *, json: Any = None, content: Any = None, **kwargs: Any + resource_group_name: str, avset: str, *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Updates the tags for an availability set. @@ -29,7 +32,7 @@ def build_update_request( :type avset: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. The tags. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). The tags. :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py index 862890164b1..e931913b0a6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, IO, List, Optional + from typing import Any, IO, List, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -108,7 +111,7 @@ def build_post_required_integer_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -155,7 +158,7 @@ def build_post_optional_integer_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -203,7 +206,7 @@ def build_post_required_integer_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -252,7 +255,7 @@ def build_post_optional_integer_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -376,7 +379,7 @@ def build_post_required_string_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -423,7 +426,7 @@ def build_post_optional_string_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -471,7 +474,7 @@ def build_post_required_string_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -520,7 +523,7 @@ def build_post_optional_string_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -644,7 +647,7 @@ def build_post_required_class_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -694,7 +697,7 @@ def build_post_optional_class_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -745,7 +748,7 @@ def build_post_required_class_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -797,7 +800,7 @@ def build_post_optional_class_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -850,7 +853,7 @@ def build_post_required_array_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -899,7 +902,7 @@ def build_post_optional_array_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -949,7 +952,7 @@ def build_post_required_array_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -1000,7 +1003,7 @@ def build_post_optional_array_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py index ef044ddf81f..37e89c18323 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py @@ -5,13 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, List, Optional +from typing import Any, IO, List, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from ..._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -76,7 +79,7 @@ def build_put_required_binary_body_request(*, content: Any, **kwargs: Any) -> Ht def build_post_required_integer_parameter_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Test explicitly required integer. Please put null and the client library should throw before the request is sent. @@ -86,7 +89,7 @@ def build_post_required_integer_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -118,7 +121,7 @@ def build_post_required_integer_parameter_request( def build_post_optional_integer_parameter_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Test explicitly optional integer. Please put null. @@ -127,7 +130,7 @@ def build_post_optional_integer_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -159,7 +162,7 @@ def build_post_optional_integer_parameter_request( def build_post_required_integer_property_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -169,7 +172,7 @@ def build_post_required_integer_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -203,7 +206,7 @@ def build_post_required_integer_property_request( def build_post_optional_integer_property_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. @@ -212,7 +215,7 @@ def build_post_optional_integer_property_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -300,7 +303,7 @@ def build_post_optional_integer_header_request(*, header_parameter: Optional[int def build_post_required_string_parameter_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Test explicitly required string. Please put null and the client library should throw before the request is sent. @@ -310,7 +313,7 @@ def build_post_required_string_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -342,7 +345,7 @@ def build_post_required_string_parameter_request( def build_post_optional_string_parameter_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: """Test explicitly optional string. Please put null. @@ -351,7 +354,7 @@ def build_post_optional_string_parameter_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -382,7 +385,9 @@ def build_post_optional_string_parameter_request( return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_required_string_property_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_required_string_property_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -391,7 +396,7 @@ def build_post_required_string_property_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -424,7 +429,9 @@ def build_post_required_string_property_request(*, json: Any = None, content: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_optional_string_property_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_optional_string_property_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -432,7 +439,7 @@ def build_post_optional_string_property_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -519,7 +526,9 @@ def build_post_optional_string_header_request(*, body_parameter: Optional[str] = return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) -def build_post_required_class_parameter_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_required_class_parameter_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required complex object. Please put null and the client library should throw before the request is sent. @@ -528,7 +537,7 @@ def build_post_required_class_parameter_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -562,7 +571,9 @@ def build_post_required_class_parameter_request(*, json: Any = None, content: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_optional_class_parameter_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_optional_class_parameter_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional complex object. Please put null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -570,7 +581,7 @@ def build_post_optional_class_parameter_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -604,7 +615,9 @@ def build_post_optional_class_parameter_request(*, json: Any = None, content: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_required_class_property_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_required_class_property_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -613,7 +626,7 @@ def build_post_required_class_property_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -649,7 +662,9 @@ def build_post_required_class_property_request(*, json: Any = None, content: Any return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_optional_class_property_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_optional_class_property_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -657,7 +672,7 @@ def build_post_optional_class_property_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -693,7 +708,9 @@ def build_post_optional_class_property_request(*, json: Any = None, content: Any return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_required_array_parameter_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_required_array_parameter_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required array. Please put null and the client library should throw before the request is sent. @@ -702,7 +719,7 @@ def build_post_required_array_parameter_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -735,7 +752,9 @@ def build_post_required_array_parameter_request(*, json: Any = None, content: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_optional_array_parameter_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_optional_array_parameter_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional array. Please put null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -743,7 +762,7 @@ def build_post_optional_array_parameter_request(*, json: Any = None, content: An :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -776,7 +795,9 @@ def build_post_optional_array_parameter_request(*, json: Any = None, content: An return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_required_array_property_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_required_array_property_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -785,7 +806,7 @@ def build_post_required_array_property_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -820,7 +841,9 @@ def build_post_required_array_property_request(*, json: Any = None, content: Any return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) -def build_post_optional_array_property_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_optional_array_property_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -828,7 +851,7 @@ def build_post_optional_array_property_request(*, json: Any = None, content: Any :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py index 080905ffc5a..bb9b9ab7c3e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, IO, List, Optional + from typing import Any, IO, List, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -148,7 +151,7 @@ def build_put_optional_body_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py index 36cd78ebd1d..255e9bec884 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py @@ -5,13 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, List, Optional +from typing import Any, IO, List, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from ..._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -102,7 +105,7 @@ def build_put_optional_header_request(*, query_parameter: Optional[str] = None, return HttpRequest(method="PUT", url=url, headers=header_parameters, **kwargs) -def build_put_optional_body_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_optional_body_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """Test implicitly optional body parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -110,7 +113,7 @@ def build_put_optional_body_request(*, json: Any = None, content: Any = None, ** :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py index 8441329dfbb..4f6b1b7225b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py @@ -14,7 +14,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -123,7 +126,7 @@ def build_validation_of_body_request( :paramtype api_version: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -258,7 +261,7 @@ def build_post_with_constant_in_body_request( :paramtype constant_param: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py index 4ca08b00e95..1c0ab709536 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py @@ -5,13 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from .._vendor import _format_url_section +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -88,7 +91,13 @@ def build_validation_of_method_parameters_request( def build_validation_of_body_request( - subscription_id: str, resource_group_name: str, id: int, *, json: Any = None, content: Any = None, **kwargs: Any + subscription_id: str, + resource_group_name: str, + id: int, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Validates body parameters on the method. See swagger for details. @@ -106,7 +115,7 @@ def build_validation_of_body_request( :paramtype api_version: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any @@ -218,7 +227,9 @@ def build_get_with_constant_in_path_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, **kwargs) -def build_post_with_constant_in_body_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_with_constant_in_body_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: """post_with_constant_in_body. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -229,7 +240,7 @@ def build_post_with_constant_in_body_request(*, json: Any = None, content: Any = :paramtype constant_param: str :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py index de5f75214dd..92919387a40 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py @@ -12,7 +12,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, List, Optional + from typing import Any, List, Optional, TypeVar + + T = TypeVar("T") + JSONType = Any _SERIALIZER = Serializer() @@ -1293,7 +1296,7 @@ def build_json_input_request( :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py index b91959bd367..e7620ce87a5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py @@ -5,11 +5,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, List, Optional +from typing import Any, List, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer +T = TypeVar("T") +JSONType = Any + _SERIALIZER = Serializer() @@ -1059,7 +1062,7 @@ def build_list_blobs_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) -def build_json_input_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_json_input_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID number 42. @@ -1068,7 +1071,7 @@ def build_json_input_request(*, json: Any = None, content: Any = None, **kwargs: :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in our example to find the input shape. - :paramtype json: any + :paramtype json: JSONType :keyword content: Pass in binary content you want in the body of the request (typically bytes, a byte iterator, or stream input). :paramtype content: any diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py index 6c445f2a9ca..31abc9fdba5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py @@ -31,6 +31,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,13 +54,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def create_ap_true(self, create_parameters: Any, **kwargs: Any) -> Any: + async def create_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -79,7 +80,7 @@ async def create_ap_true(self, create_parameters: Any, **kwargs: Any) -> Any: "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -114,13 +115,13 @@ async def create_ap_true(self, create_parameters: Any, **kwargs: Any) -> Any: create_ap_true.metadata = {"url": "/additionalProperties/true"} # type: ignore @distributed_trace_async - async def create_cat_ap_true(self, create_parameters: Any, **kwargs: Any) -> Any: + async def create_cat_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: """Create a CatAPTrue which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -142,7 +143,7 @@ async def create_cat_ap_true(self, create_parameters: Any, **kwargs: Any) -> Any "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -177,13 +178,13 @@ async def create_cat_ap_true(self, create_parameters: Any, **kwargs: Any) -> Any create_cat_ap_true.metadata = {"url": "/additionalProperties/true-subclass"} # type: ignore @distributed_trace_async - async def create_ap_object(self, create_parameters: Any, **kwargs: Any) -> Any: + async def create_ap_object(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -203,7 +204,7 @@ async def create_ap_object(self, create_parameters: Any, **kwargs: Any) -> Any: "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -238,13 +239,13 @@ async def create_ap_object(self, create_parameters: Any, **kwargs: Any) -> Any: create_ap_object.metadata = {"url": "/additionalProperties/type/object"} # type: ignore @distributed_trace_async - async def create_ap_string(self, create_parameters: Any, **kwargs: Any) -> Any: + async def create_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -264,7 +265,7 @@ async def create_ap_string(self, create_parameters: Any, **kwargs: Any) -> Any: "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -299,13 +300,13 @@ async def create_ap_string(self, create_parameters: Any, **kwargs: Any) -> Any: create_ap_string.metadata = {"url": "/additionalProperties/type/string"} # type: ignore @distributed_trace_async - async def create_ap_in_properties(self, create_parameters: Any, **kwargs: Any) -> Any: + async def create_ap_in_properties(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -325,7 +326,7 @@ async def create_ap_in_properties(self, create_parameters: Any, **kwargs: Any) - "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -360,13 +361,13 @@ async def create_ap_in_properties(self, create_parameters: Any, **kwargs: Any) - create_ap_in_properties.metadata = {"url": "/additionalProperties/in/properties"} # type: ignore @distributed_trace_async - async def create_ap_in_properties_with_ap_string(self, create_parameters: Any, **kwargs: Any) -> Any: + async def create_ap_in_properties_with_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -394,7 +395,7 @@ async def create_ap_in_properties_with_ap_string(self, create_parameters: Any, * "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py index f7b3d3dfa17..33d4b05ec46 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -197,16 +198,16 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def create_ap_true( self, - create_parameters, # type: Any + create_parameters, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -226,7 +227,7 @@ def create_ap_true( "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -263,16 +264,16 @@ def create_ap_true( @distributed_trace def create_cat_ap_true( self, - create_parameters, # type: Any + create_parameters, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Create a CatAPTrue which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -294,7 +295,7 @@ def create_cat_ap_true( "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -331,16 +332,16 @@ def create_cat_ap_true( @distributed_trace def create_ap_object( self, - create_parameters, # type: Any + create_parameters, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -360,7 +361,7 @@ def create_ap_object( "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -397,16 +398,16 @@ def create_ap_object( @distributed_trace def create_ap_string( self, - create_parameters, # type: Any + create_parameters, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -426,7 +427,7 @@ def create_ap_string( "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -463,16 +464,16 @@ def create_ap_string( @distributed_trace def create_ap_in_properties( self, - create_parameters, # type: Any + create_parameters, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -492,7 +493,7 @@ def create_ap_in_properties( "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -529,16 +530,16 @@ def create_ap_in_properties( @distributed_trace def create_ap_in_properties_with_ap_string( self, - create_parameters, # type: Any + create_parameters, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Create a Pet which contains more properties than what is defined. :param create_parameters: - :type create_parameters: Any + :type create_parameters: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -566,7 +567,7 @@ def create_ap_in_properties_with_ap_string( "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/operations/_operations.py index 3805f7d0b4f..afb37812161 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/operations/_operations.py @@ -31,6 +31,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/operations/_operations.py index e20525315b0..c253335f94a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py index 3f5a6eeb538..4ba637d3c98 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py @@ -95,6 +95,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -2385,11 +2386,11 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore @distributed_trace_async - async def get_complex_null(self, **kwargs: Any) -> List[Any]: + async def get_complex_null(self, **kwargs: Any) -> List[JSONType]: """Get array of complex type null value. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2403,7 +2404,7 @@ async def get_complex_null(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2432,11 +2433,11 @@ async def get_complex_null(self, **kwargs: Any) -> List[Any]: get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore @distributed_trace_async - async def get_complex_empty(self, **kwargs: Any) -> List[Any]: + async def get_complex_empty(self, **kwargs: Any) -> List[JSONType]: """Get empty array of complex type []. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2450,7 +2451,7 @@ async def get_complex_empty(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2479,12 +2480,12 @@ async def get_complex_empty(self, **kwargs: Any) -> List[Any]: get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore @distributed_trace_async - async def get_complex_item_null(self, **kwargs: Any) -> List[Any]: + async def get_complex_item_null(self, **kwargs: Any) -> List[JSONType]: """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2498,7 +2499,7 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2527,12 +2528,12 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[Any]: get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore @distributed_trace_async - async def get_complex_item_empty(self, **kwargs: Any) -> List[Any]: + async def get_complex_item_empty(self, **kwargs: Any) -> List[JSONType]: """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2546,7 +2547,7 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2575,12 +2576,12 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[Any]: get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore @distributed_trace_async - async def get_complex_valid(self, **kwargs: Any) -> List[Any]: + async def get_complex_valid(self, **kwargs: Any) -> List[JSONType]: """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2594,7 +2595,7 @@ async def get_complex_valid(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2623,12 +2624,12 @@ async def get_complex_valid(self, **kwargs: Any) -> List[Any]: get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore @distributed_trace_async - async def put_complex_valid(self, array_body: List[Any], **kwargs: Any) -> None: + async def put_complex_valid(self, array_body: List[JSONType], **kwargs: Any) -> None: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. :param array_body: - :type array_body: list[Any] + :type array_body: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py index c944530b7a4..47ab0ba563c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -3958,11 +3959,11 @@ def get_base64_url( def get_complex_null( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Get array of complex type null value. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3976,7 +3977,7 @@ def get_complex_null( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4008,11 +4009,11 @@ def get_complex_null( def get_complex_empty( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Get empty array of complex type []. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4026,7 +4027,7 @@ def get_complex_empty( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4058,12 +4059,12 @@ def get_complex_empty( def get_complex_item_null( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4077,7 +4078,7 @@ def get_complex_item_null( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4109,12 +4110,12 @@ def get_complex_item_null( def get_complex_item_empty( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4128,7 +4129,7 @@ def get_complex_item_empty( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4160,12 +4161,12 @@ def get_complex_item_empty( def get_complex_valid( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4179,7 +4180,7 @@ def get_complex_valid( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4210,7 +4211,7 @@ def get_complex_valid( @distributed_trace def put_complex_valid( self, - array_body, # type: List[Any] + array_body, # type: List[JSONType] **kwargs # type: Any ): # type: (...) -> None @@ -4218,7 +4219,7 @@ def put_complex_valid( 'string': '4'}, {'integer': 5, 'string': '6'}]. :param array_body: - :type array_body: list[Any] + :type array_body: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py index f9b64b8d25b..5f99631cb17 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import build_upload_binary_request, build_upload_file_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py index cccf37dd43e..25b0e181c9f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py index 8cce993c971..b093a5d4344 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py @@ -31,6 +31,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py index a71405fe5c1..ff7779b5a50 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py index b75b4ad51cb..1845f12334e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py @@ -30,6 +30,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py index fc61ab4d2f3..f62ecca42f7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/_operations.py index a9e217275e6..f34eba87369 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/_operations.py @@ -80,6 +80,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -102,11 +103,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -119,7 +120,7 @@ async def get_valid(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -148,11 +149,11 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. - :type complex_body: Any + :type complex_body: JSONType :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -200,11 +201,11 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> Any: + async def get_invalid(self, **kwargs: Any) -> JSONType: """Get a basic complex type that is invalid for the local strong type. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -217,7 +218,7 @@ async def get_invalid(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -246,11 +247,11 @@ async def get_invalid(self, **kwargs: Any) -> Any: get_invalid.metadata = {"url": "/complex/basic/invalid"} # type: ignore @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> Any: + async def get_empty(self, **kwargs: Any) -> JSONType: """Get a basic complex type that is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -263,7 +264,7 @@ async def get_empty(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -292,11 +293,11 @@ async def get_empty(self, **kwargs: Any) -> Any: get_empty.metadata = {"url": "/complex/basic/empty"} # type: ignore @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Any: + async def get_null(self, **kwargs: Any) -> JSONType: """Get a basic complex type whose properties are null. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -309,7 +310,7 @@ async def get_null(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -338,11 +339,11 @@ async def get_null(self, **kwargs: Any) -> Any: get_null.metadata = {"url": "/complex/basic/null"} # type: ignore @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> Any: + async def get_not_provided(self, **kwargs: Any) -> JSONType: """Get a basic complex type while the server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -355,7 +356,7 @@ async def get_not_provided(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -403,11 +404,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_int(self, **kwargs: Any) -> Any: + async def get_int(self, **kwargs: Any) -> JSONType: """Get complex types with integer properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -419,7 +420,7 @@ async def get_int(self, **kwargs: Any) -> Any: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -448,11 +449,11 @@ async def get_int(self, **kwargs: Any) -> Any: get_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore @distributed_trace_async - async def put_int(self, complex_body: Any, **kwargs: Any) -> None: + async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -494,11 +495,11 @@ async def put_int(self, complex_body: Any, **kwargs: Any) -> None: put_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore @distributed_trace_async - async def get_long(self, **kwargs: Any) -> Any: + async def get_long(self, **kwargs: Any) -> JSONType: """Get complex types with long properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -510,7 +511,7 @@ async def get_long(self, **kwargs: Any) -> Any: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -539,11 +540,11 @@ async def get_long(self, **kwargs: Any) -> Any: get_long.metadata = {"url": "/complex/primitive/long"} # type: ignore @distributed_trace_async - async def put_long(self, complex_body: Any, **kwargs: Any) -> None: + async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -585,11 +586,11 @@ async def put_long(self, complex_body: Any, **kwargs: Any) -> None: put_long.metadata = {"url": "/complex/primitive/long"} # type: ignore @distributed_trace_async - async def get_float(self, **kwargs: Any) -> Any: + async def get_float(self, **kwargs: Any) -> JSONType: """Get complex types with float properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -601,7 +602,7 @@ async def get_float(self, **kwargs: Any) -> Any: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -630,11 +631,11 @@ async def get_float(self, **kwargs: Any) -> Any: get_float.metadata = {"url": "/complex/primitive/float"} # type: ignore @distributed_trace_async - async def put_float(self, complex_body: Any, **kwargs: Any) -> None: + async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -676,11 +677,11 @@ async def put_float(self, complex_body: Any, **kwargs: Any) -> None: put_float.metadata = {"url": "/complex/primitive/float"} # type: ignore @distributed_trace_async - async def get_double(self, **kwargs: Any) -> Any: + async def get_double(self, **kwargs: Any) -> JSONType: """Get complex types with double properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -692,7 +693,7 @@ async def get_double(self, **kwargs: Any) -> Any: "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -721,12 +722,12 @@ async def get_double(self, **kwargs: Any) -> Any: get_double.metadata = {"url": "/complex/primitive/double"} # type: ignore @distributed_trace_async - async def put_double(self, complex_body: Any, **kwargs: Any) -> None: + async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and -0.000000000000000000000000000000000000000000000000000000005. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -768,11 +769,11 @@ async def put_double(self, complex_body: Any, **kwargs: Any) -> None: put_double.metadata = {"url": "/complex/primitive/double"} # type: ignore @distributed_trace_async - async def get_bool(self, **kwargs: Any) -> Any: + async def get_bool(self, **kwargs: Any) -> JSONType: """Get complex types with bool properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -784,7 +785,7 @@ async def get_bool(self, **kwargs: Any) -> Any: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -813,11 +814,11 @@ async def get_bool(self, **kwargs: Any) -> Any: get_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore @distributed_trace_async - async def put_bool(self, complex_body: Any, **kwargs: Any) -> None: + async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -859,11 +860,11 @@ async def put_bool(self, complex_body: Any, **kwargs: Any) -> None: put_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore @distributed_trace_async - async def get_string(self, **kwargs: Any) -> Any: + async def get_string(self, **kwargs: Any) -> JSONType: """Get complex types with string properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -876,7 +877,7 @@ async def get_string(self, **kwargs: Any) -> Any: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -905,11 +906,11 @@ async def get_string(self, **kwargs: Any) -> Any: get_string.metadata = {"url": "/complex/primitive/string"} # type: ignore @distributed_trace_async - async def put_string(self, complex_body: Any, **kwargs: Any) -> None: + async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -952,11 +953,11 @@ async def put_string(self, complex_body: Any, **kwargs: Any) -> None: put_string.metadata = {"url": "/complex/primitive/string"} # type: ignore @distributed_trace_async - async def get_date(self, **kwargs: Any) -> Any: + async def get_date(self, **kwargs: Any) -> JSONType: """Get complex types with date properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -968,7 +969,7 @@ async def get_date(self, **kwargs: Any) -> Any: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -997,11 +998,11 @@ async def get_date(self, **kwargs: Any) -> Any: get_date.metadata = {"url": "/complex/primitive/date"} # type: ignore @distributed_trace_async - async def put_date(self, complex_body: Any, **kwargs: Any) -> None: + async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1043,11 +1044,11 @@ async def put_date(self, complex_body: Any, **kwargs: Any) -> None: put_date.metadata = {"url": "/complex/primitive/date"} # type: ignore @distributed_trace_async - async def get_date_time(self, **kwargs: Any) -> Any: + async def get_date_time(self, **kwargs: Any) -> JSONType: """Get complex types with datetime properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1059,7 +1060,7 @@ async def get_date_time(self, **kwargs: Any) -> Any: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1088,11 +1089,11 @@ async def get_date_time(self, **kwargs: Any) -> Any: get_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore @distributed_trace_async - async def put_date_time(self, complex_body: Any, **kwargs: Any) -> None: + async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1134,11 +1135,11 @@ async def put_date_time(self, complex_body: Any, **kwargs: Any) -> None: put_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore @distributed_trace_async - async def get_date_time_rfc1123(self, **kwargs: Any) -> Any: + async def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: """Get complex types with datetimeRfc1123 properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1150,7 +1151,7 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> Any: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1179,12 +1180,12 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> Any: get_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore @distributed_trace_async - async def put_date_time_rfc1123(self, complex_body: Any, **kwargs: Any) -> None: + async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1226,11 +1227,11 @@ async def put_date_time_rfc1123(self, complex_body: Any, **kwargs: Any) -> None: put_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore @distributed_trace_async - async def get_duration(self, **kwargs: Any) -> Any: + async def get_duration(self, **kwargs: Any) -> JSONType: """Get complex types with duration properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1241,7 +1242,7 @@ async def get_duration(self, **kwargs: Any) -> Any: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1270,11 +1271,11 @@ async def get_duration(self, **kwargs: Any) -> Any: get_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore @distributed_trace_async - async def put_duration(self, complex_body: Any, **kwargs: Any) -> None: + async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with duration properties. :param complex_body: Please put 'P123DT22H14M12.011S'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1315,11 +1316,11 @@ async def put_duration(self, complex_body: Any, **kwargs: Any) -> None: put_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore @distributed_trace_async - async def get_byte(self, **kwargs: Any) -> Any: + async def get_byte(self, **kwargs: Any) -> JSONType: """Get complex types with byte properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1330,7 +1331,7 @@ async def get_byte(self, **kwargs: Any) -> Any: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1359,11 +1360,11 @@ async def get_byte(self, **kwargs: Any) -> Any: get_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore @distributed_trace_async - async def put_byte(self, complex_body: Any, **kwargs: Any) -> None: + async def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with byte properties. :param complex_body: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1423,11 +1424,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types with array property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1440,7 +1441,7 @@ async def get_valid(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1469,12 +1470,12 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/array/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with array property. :param complex_body: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog". - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1517,11 +1518,11 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/array/valid"} # type: ignore @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> Any: + async def get_empty(self, **kwargs: Any) -> JSONType: """Get complex types with array property which is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1534,7 +1535,7 @@ async def get_empty(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1563,11 +1564,11 @@ async def get_empty(self, **kwargs: Any) -> Any: get_empty.metadata = {"url": "/complex/array/empty"} # type: ignore @distributed_trace_async - async def put_empty(self, complex_body: Any, **kwargs: Any) -> None: + async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with array property which is empty. :param complex_body: Please put an empty array. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1610,11 +1611,11 @@ async def put_empty(self, complex_body: Any, **kwargs: Any) -> None: put_empty.metadata = {"url": "/complex/array/empty"} # type: ignore @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> Any: + async def get_not_provided(self, **kwargs: Any) -> JSONType: """Get complex types with array property while server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1627,7 +1628,7 @@ async def get_not_provided(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1675,11 +1676,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1692,7 +1693,7 @@ async def get_valid(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1721,12 +1722,12 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with dictionary property. :param complex_body: Please put a dictionary with 5 key-value pairs: "txt":"notepad", "bmp":"mspaint", "xls":"excel", "exe":"", "":null. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1769,11 +1770,11 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> Any: + async def get_empty(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property which is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1786,7 +1787,7 @@ async def get_empty(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1815,11 +1816,11 @@ async def get_empty(self, **kwargs: Any) -> Any: get_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore @distributed_trace_async - async def put_empty(self, complex_body: Any, **kwargs: Any) -> None: + async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with dictionary property which is empty. :param complex_body: Please put an empty dictionary. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1862,11 +1863,11 @@ async def put_empty(self, complex_body: Any, **kwargs: Any) -> None: put_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Any: + async def get_null(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property which is null. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1879,7 +1880,7 @@ async def get_null(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1908,11 +1909,11 @@ async def get_null(self, **kwargs: Any) -> Any: get_null.metadata = {"url": "/complex/dictionary/typed/null"} # type: ignore @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> Any: + async def get_not_provided(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property while server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1925,7 +1926,7 @@ async def get_not_provided(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1973,11 +1974,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that extend others. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1998,7 +1999,7 @@ async def get_valid(self, **kwargs: Any) -> Any: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2027,13 +2028,13 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one named "Tomato" with id=-1 and food="french fries". - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2103,11 +2104,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2123,7 +2124,7 @@ async def get_valid(self, **kwargs: Any) -> Any: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2152,7 +2153,7 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -2188,7 +2189,7 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: } ] };. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2236,11 +2237,11 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore @distributed_trace_async - async def get_dot_syntax(self, **kwargs: Any) -> Any: + async def get_dot_syntax(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic, JSON key contains a dot. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2252,7 +2253,7 @@ async def get_dot_syntax(self, **kwargs: Any) -> Any: fish.type: fish.type } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2281,13 +2282,13 @@ async def get_dot_syntax(self, **kwargs: Any) -> Any: get_dot_syntax.metadata = {"url": "/complex/polymorphism/dotsyntax"} # type: ignore @distributed_trace_async - async def get_composed_with_discriminator(self, **kwargs: Any) -> Any: + async def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2321,7 +2322,7 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2350,13 +2351,13 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> Any: get_composed_with_discriminator.metadata = {"url": "/complex/polymorphism/composedWithDiscriminator"} # type: ignore @distributed_trace_async - async def get_composed_without_discriminator(self, **kwargs: Any) -> Any: + async def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2390,7 +2391,7 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2419,12 +2420,12 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> Any: get_composed_without_discriminator.metadata = {"url": "/complex/polymorphism/composedWithoutDiscriminator"} # type: ignore @distributed_trace_async - async def get_complicated(self, **kwargs: Any) -> Any: + async def get_complicated(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2449,7 +2450,7 @@ async def get_complicated(self, **kwargs: Any) -> Any: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2478,12 +2479,12 @@ async def get_complicated(self, **kwargs: Any) -> Any: get_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore @distributed_trace_async - async def put_complicated(self, complex_body: Any, **kwargs: Any) -> None: + async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2540,13 +2541,13 @@ async def put_complicated(self, complex_body: Any, **kwargs: Any) -> None: put_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore @distributed_trace_async - async def put_missing_discriminator(self, complex_body: Any, **kwargs: Any) -> Any: + async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JSONType: """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2592,7 +2593,7 @@ async def put_missing_discriminator(self, complex_body: Any, **kwargs: Any) -> A fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2627,7 +2628,7 @@ async def put_missing_discriminator(self, complex_body: Any, **kwargs: Any) -> A put_missing_discriminator.metadata = {"url": "/complex/polymorphism/missingdiscriminator"} # type: ignore @distributed_trace_async - async def put_valid_missing_required(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -2658,7 +2659,7 @@ async def put_valid_missing_required(self, complex_body: Any, **kwargs: Any) -> } ] }. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2725,11 +2726,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic and have recursive references. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2745,7 +2746,7 @@ async def get_valid(self, **kwargs: Any) -> Any: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2774,7 +2775,7 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -2830,7 +2831,7 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: } ] }. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2897,11 +2898,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that have readonly properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2913,7 +2914,7 @@ async def get_valid(self, **kwargs: Any) -> Any: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2942,11 +2943,11 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that have readonly properties. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3007,11 +3008,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """get_valid. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3026,7 +3027,7 @@ async def get_valid(self, **kwargs: Any) -> Any: kind: kind } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/_operations_py3.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/_operations_py3.py index b94d6ca8eed..7c88113cc29 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/_operations_py3.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/_operations_py3.py @@ -23,6 +23,7 @@ from msrest import Serializer T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -40,7 +41,7 @@ def build_basic_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_basic_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_basic_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: api_version = kwargs.pop("api_version", "2016-02-29") # type: str content_type = kwargs.pop("content_type", None) # type: Optional[str] @@ -123,7 +124,7 @@ def build_primitive_get_int_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_int_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_int_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -151,7 +152,7 @@ def build_primitive_get_long_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_long_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_long_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -179,7 +180,7 @@ def build_primitive_get_float_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_float_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -207,7 +208,7 @@ def build_primitive_get_double_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_double_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -235,7 +236,7 @@ def build_primitive_get_bool_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_bool_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_bool_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -263,7 +264,7 @@ def build_primitive_get_string_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_string_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -291,7 +292,7 @@ def build_primitive_get_date_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_date_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -319,7 +320,7 @@ def build_primitive_get_date_time_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_date_time_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -348,7 +349,7 @@ def build_primitive_get_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: def build_primitive_put_date_time_rfc1123_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] @@ -377,7 +378,7 @@ def build_primitive_get_duration_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_duration_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -405,7 +406,7 @@ def build_primitive_get_byte_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_primitive_put_byte_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_primitive_put_byte_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -433,7 +434,7 @@ def build_array_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_array_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_array_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -461,7 +462,7 @@ def build_array_get_empty_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_array_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_array_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -501,7 +502,7 @@ def build_dictionary_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_dictionary_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_dictionary_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -529,7 +530,7 @@ def build_dictionary_get_empty_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_dictionary_put_empty_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_dictionary_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -581,7 +582,7 @@ def build_inheritance_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_inheritance_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_inheritance_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -609,7 +610,7 @@ def build_polymorphism_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_polymorphism_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_polymorphism_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -673,7 +674,9 @@ def build_polymorphism_get_complicated_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_polymorphism_put_complicated_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_polymorphism_put_complicated_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -690,7 +693,7 @@ def build_polymorphism_put_complicated_request(*, json: Any = None, content: Any def build_polymorphism_put_missing_discriminator_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] @@ -708,7 +711,7 @@ def build_polymorphism_put_missing_discriminator_request( def build_polymorphism_put_valid_missing_required_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] @@ -738,7 +741,7 @@ def build_polymorphicrecursive_get_valid_request(**kwargs: Any) -> HttpRequest: def build_polymorphicrecursive_put_valid_request( - *, json: Any = None, content: Any = None, **kwargs: Any + *, json: JSONType = None, content: Any = None, **kwargs: Any ) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] @@ -767,7 +770,9 @@ def build_readonlyproperty_get_valid_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) -def build_readonlyproperty_put_valid_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_readonlyproperty_put_valid_request( + *, json: JSONType = None, content: Any = None, **kwargs: Any +) -> HttpRequest: content_type = kwargs.pop("content_type", None) # type: Optional[str] accept = "application/json" @@ -814,11 +819,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> Any: + def get_valid(self, **kwargs: Any) -> JSONType: """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -831,7 +836,7 @@ def get_valid(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -860,11 +865,11 @@ def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore @distributed_trace - def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. - :type complex_body: Any + :type complex_body: JSONType :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -912,11 +917,11 @@ def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore @distributed_trace - def get_invalid(self, **kwargs: Any) -> Any: + def get_invalid(self, **kwargs: Any) -> JSONType: """Get a basic complex type that is invalid for the local strong type. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -929,7 +934,7 @@ def get_invalid(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -958,11 +963,11 @@ def get_invalid(self, **kwargs: Any) -> Any: get_invalid.metadata = {"url": "/complex/basic/invalid"} # type: ignore @distributed_trace - def get_empty(self, **kwargs: Any) -> Any: + def get_empty(self, **kwargs: Any) -> JSONType: """Get a basic complex type that is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -975,7 +980,7 @@ def get_empty(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1004,11 +1009,11 @@ def get_empty(self, **kwargs: Any) -> Any: get_empty.metadata = {"url": "/complex/basic/empty"} # type: ignore @distributed_trace - def get_null(self, **kwargs: Any) -> Any: + def get_null(self, **kwargs: Any) -> JSONType: """Get a basic complex type whose properties are null. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1021,7 +1026,7 @@ def get_null(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1050,11 +1055,11 @@ def get_null(self, **kwargs: Any) -> Any: get_null.metadata = {"url": "/complex/basic/null"} # type: ignore @distributed_trace - def get_not_provided(self, **kwargs: Any) -> Any: + def get_not_provided(self, **kwargs: Any) -> JSONType: """Get a basic complex type while the server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1067,7 +1072,7 @@ def get_not_provided(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1115,11 +1120,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_int(self, **kwargs: Any) -> Any: + def get_int(self, **kwargs: Any) -> JSONType: """Get complex types with integer properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1131,7 +1136,7 @@ def get_int(self, **kwargs: Any) -> Any: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1160,11 +1165,11 @@ def get_int(self, **kwargs: Any) -> Any: get_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore @distributed_trace - def put_int(self, complex_body: Any, **kwargs: Any) -> None: + def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1206,11 +1211,11 @@ def put_int(self, complex_body: Any, **kwargs: Any) -> None: put_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore @distributed_trace - def get_long(self, **kwargs: Any) -> Any: + def get_long(self, **kwargs: Any) -> JSONType: """Get complex types with long properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1222,7 +1227,7 @@ def get_long(self, **kwargs: Any) -> Any: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1251,11 +1256,11 @@ def get_long(self, **kwargs: Any) -> Any: get_long.metadata = {"url": "/complex/primitive/long"} # type: ignore @distributed_trace - def put_long(self, complex_body: Any, **kwargs: Any) -> None: + def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1297,11 +1302,11 @@ def put_long(self, complex_body: Any, **kwargs: Any) -> None: put_long.metadata = {"url": "/complex/primitive/long"} # type: ignore @distributed_trace - def get_float(self, **kwargs: Any) -> Any: + def get_float(self, **kwargs: Any) -> JSONType: """Get complex types with float properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1313,7 +1318,7 @@ def get_float(self, **kwargs: Any) -> Any: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1342,11 +1347,11 @@ def get_float(self, **kwargs: Any) -> Any: get_float.metadata = {"url": "/complex/primitive/float"} # type: ignore @distributed_trace - def put_float(self, complex_body: Any, **kwargs: Any) -> None: + def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1388,11 +1393,11 @@ def put_float(self, complex_body: Any, **kwargs: Any) -> None: put_float.metadata = {"url": "/complex/primitive/float"} # type: ignore @distributed_trace - def get_double(self, **kwargs: Any) -> Any: + def get_double(self, **kwargs: Any) -> JSONType: """Get complex types with double properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1404,7 +1409,7 @@ def get_double(self, **kwargs: Any) -> Any: "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1433,12 +1438,12 @@ def get_double(self, **kwargs: Any) -> Any: get_double.metadata = {"url": "/complex/primitive/double"} # type: ignore @distributed_trace - def put_double(self, complex_body: Any, **kwargs: Any) -> None: + def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and -0.000000000000000000000000000000000000000000000000000000005. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1480,11 +1485,11 @@ def put_double(self, complex_body: Any, **kwargs: Any) -> None: put_double.metadata = {"url": "/complex/primitive/double"} # type: ignore @distributed_trace - def get_bool(self, **kwargs: Any) -> Any: + def get_bool(self, **kwargs: Any) -> JSONType: """Get complex types with bool properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1496,7 +1501,7 @@ def get_bool(self, **kwargs: Any) -> Any: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1525,11 +1530,11 @@ def get_bool(self, **kwargs: Any) -> Any: get_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore @distributed_trace - def put_bool(self, complex_body: Any, **kwargs: Any) -> None: + def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1571,11 +1576,11 @@ def put_bool(self, complex_body: Any, **kwargs: Any) -> None: put_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore @distributed_trace - def get_string(self, **kwargs: Any) -> Any: + def get_string(self, **kwargs: Any) -> JSONType: """Get complex types with string properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1588,7 +1593,7 @@ def get_string(self, **kwargs: Any) -> Any: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1617,11 +1622,11 @@ def get_string(self, **kwargs: Any) -> Any: get_string.metadata = {"url": "/complex/primitive/string"} # type: ignore @distributed_trace - def put_string(self, complex_body: Any, **kwargs: Any) -> None: + def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1664,11 +1669,11 @@ def put_string(self, complex_body: Any, **kwargs: Any) -> None: put_string.metadata = {"url": "/complex/primitive/string"} # type: ignore @distributed_trace - def get_date(self, **kwargs: Any) -> Any: + def get_date(self, **kwargs: Any) -> JSONType: """Get complex types with date properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1680,7 +1685,7 @@ def get_date(self, **kwargs: Any) -> Any: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1709,11 +1714,11 @@ def get_date(self, **kwargs: Any) -> Any: get_date.metadata = {"url": "/complex/primitive/date"} # type: ignore @distributed_trace - def put_date(self, complex_body: Any, **kwargs: Any) -> None: + def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1755,11 +1760,11 @@ def put_date(self, complex_body: Any, **kwargs: Any) -> None: put_date.metadata = {"url": "/complex/primitive/date"} # type: ignore @distributed_trace - def get_date_time(self, **kwargs: Any) -> Any: + def get_date_time(self, **kwargs: Any) -> JSONType: """Get complex types with datetime properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1771,7 +1776,7 @@ def get_date_time(self, **kwargs: Any) -> Any: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1800,11 +1805,11 @@ def get_date_time(self, **kwargs: Any) -> Any: get_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore @distributed_trace - def put_date_time(self, complex_body: Any, **kwargs: Any) -> None: + def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1846,11 +1851,11 @@ def put_date_time(self, complex_body: Any, **kwargs: Any) -> None: put_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore @distributed_trace - def get_date_time_rfc1123(self, **kwargs: Any) -> Any: + def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: """Get complex types with datetimeRfc1123 properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1862,7 +1867,7 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> Any: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1891,12 +1896,12 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> Any: get_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore @distributed_trace - def put_date_time_rfc1123(self, complex_body: Any, **kwargs: Any) -> None: + def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1938,11 +1943,11 @@ def put_date_time_rfc1123(self, complex_body: Any, **kwargs: Any) -> None: put_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore @distributed_trace - def get_duration(self, **kwargs: Any) -> Any: + def get_duration(self, **kwargs: Any) -> JSONType: """Get complex types with duration properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1953,7 +1958,7 @@ def get_duration(self, **kwargs: Any) -> Any: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1982,11 +1987,11 @@ def get_duration(self, **kwargs: Any) -> Any: get_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore @distributed_trace - def put_duration(self, complex_body: Any, **kwargs: Any) -> None: + def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with duration properties. :param complex_body: Please put 'P123DT22H14M12.011S'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2027,11 +2032,11 @@ def put_duration(self, complex_body: Any, **kwargs: Any) -> None: put_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore @distributed_trace - def get_byte(self, **kwargs: Any) -> Any: + def get_byte(self, **kwargs: Any) -> JSONType: """Get complex types with byte properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2042,7 +2047,7 @@ def get_byte(self, **kwargs: Any) -> Any: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2071,11 +2076,11 @@ def get_byte(self, **kwargs: Any) -> Any: get_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore @distributed_trace - def put_byte(self, complex_body: Any, **kwargs: Any) -> None: + def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with byte properties. :param complex_body: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2135,11 +2140,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> Any: + def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types with array property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2152,7 +2157,7 @@ def get_valid(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2181,12 +2186,12 @@ def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/array/valid"} # type: ignore @distributed_trace - def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with array property. :param complex_body: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog". - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2229,11 +2234,11 @@ def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/array/valid"} # type: ignore @distributed_trace - def get_empty(self, **kwargs: Any) -> Any: + def get_empty(self, **kwargs: Any) -> JSONType: """Get complex types with array property which is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2246,7 +2251,7 @@ def get_empty(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2275,11 +2280,11 @@ def get_empty(self, **kwargs: Any) -> Any: get_empty.metadata = {"url": "/complex/array/empty"} # type: ignore @distributed_trace - def put_empty(self, complex_body: Any, **kwargs: Any) -> None: + def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with array property which is empty. :param complex_body: Please put an empty array. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2322,11 +2327,11 @@ def put_empty(self, complex_body: Any, **kwargs: Any) -> None: put_empty.metadata = {"url": "/complex/array/empty"} # type: ignore @distributed_trace - def get_not_provided(self, **kwargs: Any) -> Any: + def get_not_provided(self, **kwargs: Any) -> JSONType: """Get complex types with array property while server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2339,7 +2344,7 @@ def get_not_provided(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2387,11 +2392,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> Any: + def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2404,7 +2409,7 @@ def get_valid(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2433,12 +2438,12 @@ def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore @distributed_trace - def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with dictionary property. :param complex_body: Please put a dictionary with 5 key-value pairs: "txt":"notepad", "bmp":"mspaint", "xls":"excel", "exe":"", "":null. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2481,11 +2486,11 @@ def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore @distributed_trace - def get_empty(self, **kwargs: Any) -> Any: + def get_empty(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property which is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2498,7 +2503,7 @@ def get_empty(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2527,11 +2532,11 @@ def get_empty(self, **kwargs: Any) -> Any: get_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore @distributed_trace - def put_empty(self, complex_body: Any, **kwargs: Any) -> None: + def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with dictionary property which is empty. :param complex_body: Please put an empty dictionary. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2574,11 +2579,11 @@ def put_empty(self, complex_body: Any, **kwargs: Any) -> None: put_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore @distributed_trace - def get_null(self, **kwargs: Any) -> Any: + def get_null(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property which is null. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2591,7 +2596,7 @@ def get_null(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2620,11 +2625,11 @@ def get_null(self, **kwargs: Any) -> Any: get_null.metadata = {"url": "/complex/dictionary/typed/null"} # type: ignore @distributed_trace - def get_not_provided(self, **kwargs: Any) -> Any: + def get_not_provided(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property while server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2637,7 +2642,7 @@ def get_not_provided(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2685,11 +2690,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> Any: + def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that extend others. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2710,7 +2715,7 @@ def get_valid(self, **kwargs: Any) -> Any: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2739,13 +2744,13 @@ def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore @distributed_trace - def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one named "Tomato" with id=-1 and food="french fries". - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2815,11 +2820,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> Any: + def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2835,7 +2840,7 @@ def get_valid(self, **kwargs: Any) -> Any: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2864,7 +2869,7 @@ def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore @distributed_trace - def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -2900,7 +2905,7 @@ def put_valid(self, complex_body: Any, **kwargs: Any) -> None: } ] };. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2948,11 +2953,11 @@ def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore @distributed_trace - def get_dot_syntax(self, **kwargs: Any) -> Any: + def get_dot_syntax(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic, JSON key contains a dot. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2964,7 +2969,7 @@ def get_dot_syntax(self, **kwargs: Any) -> Any: fish.type: fish.type } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2993,13 +2998,13 @@ def get_dot_syntax(self, **kwargs: Any) -> Any: get_dot_syntax.metadata = {"url": "/complex/polymorphism/dotsyntax"} # type: ignore @distributed_trace - def get_composed_with_discriminator(self, **kwargs: Any) -> Any: + def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3033,7 +3038,7 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3062,13 +3067,13 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> Any: get_composed_with_discriminator.metadata = {"url": "/complex/polymorphism/composedWithDiscriminator"} # type: ignore @distributed_trace - def get_composed_without_discriminator(self, **kwargs: Any) -> Any: + def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3102,7 +3107,7 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3131,12 +3136,12 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> Any: get_composed_without_discriminator.metadata = {"url": "/complex/polymorphism/composedWithoutDiscriminator"} # type: ignore @distributed_trace - def get_complicated(self, **kwargs: Any) -> Any: + def get_complicated(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3161,7 +3166,7 @@ def get_complicated(self, **kwargs: Any) -> Any: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3190,12 +3195,12 @@ def get_complicated(self, **kwargs: Any) -> Any: get_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore @distributed_trace - def put_complicated(self, complex_body: Any, **kwargs: Any) -> None: + def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3252,13 +3257,13 @@ def put_complicated(self, complex_body: Any, **kwargs: Any) -> None: put_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore @distributed_trace - def put_missing_discriminator(self, complex_body: Any, **kwargs: Any) -> Any: + def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JSONType: """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3304,7 +3309,7 @@ def put_missing_discriminator(self, complex_body: Any, **kwargs: Any) -> Any: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3339,7 +3344,7 @@ def put_missing_discriminator(self, complex_body: Any, **kwargs: Any) -> Any: put_missing_discriminator.metadata = {"url": "/complex/polymorphism/missingdiscriminator"} # type: ignore @distributed_trace - def put_valid_missing_required(self, complex_body: Any, **kwargs: Any) -> None: + def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -3370,7 +3375,7 @@ def put_valid_missing_required(self, complex_body: Any, **kwargs: Any) -> None: } ] }. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3437,11 +3442,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> Any: + def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic and have recursive references. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3457,7 +3462,7 @@ def get_valid(self, **kwargs: Any) -> Any: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3486,7 +3491,7 @@ def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore @distributed_trace - def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -3542,7 +3547,7 @@ def put_valid(self, complex_body: Any, **kwargs: Any) -> None: } ] }. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3609,11 +3614,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> Any: + def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that have readonly properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3625,7 +3630,7 @@ def get_valid(self, **kwargs: Any) -> Any: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3654,11 +3659,11 @@ def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore @distributed_trace - def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that have readonly properties. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3719,11 +3724,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> Any: + def get_valid(self, **kwargs: Any) -> JSONType: """get_valid. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3738,7 +3743,7 @@ def get_valid(self, **kwargs: Any) -> Any: kind: kind } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py index a9e217275e6..f34eba87369 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py @@ -80,6 +80,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -102,11 +103,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -119,7 +120,7 @@ async def get_valid(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -148,11 +149,11 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. - :type complex_body: Any + :type complex_body: JSONType :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -200,11 +201,11 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> Any: + async def get_invalid(self, **kwargs: Any) -> JSONType: """Get a basic complex type that is invalid for the local strong type. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -217,7 +218,7 @@ async def get_invalid(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -246,11 +247,11 @@ async def get_invalid(self, **kwargs: Any) -> Any: get_invalid.metadata = {"url": "/complex/basic/invalid"} # type: ignore @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> Any: + async def get_empty(self, **kwargs: Any) -> JSONType: """Get a basic complex type that is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -263,7 +264,7 @@ async def get_empty(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -292,11 +293,11 @@ async def get_empty(self, **kwargs: Any) -> Any: get_empty.metadata = {"url": "/complex/basic/empty"} # type: ignore @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Any: + async def get_null(self, **kwargs: Any) -> JSONType: """Get a basic complex type whose properties are null. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -309,7 +310,7 @@ async def get_null(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -338,11 +339,11 @@ async def get_null(self, **kwargs: Any) -> Any: get_null.metadata = {"url": "/complex/basic/null"} # type: ignore @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> Any: + async def get_not_provided(self, **kwargs: Any) -> JSONType: """Get a basic complex type while the server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -355,7 +356,7 @@ async def get_not_provided(self, **kwargs: Any) -> Any: "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -403,11 +404,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_int(self, **kwargs: Any) -> Any: + async def get_int(self, **kwargs: Any) -> JSONType: """Get complex types with integer properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -419,7 +420,7 @@ async def get_int(self, **kwargs: Any) -> Any: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -448,11 +449,11 @@ async def get_int(self, **kwargs: Any) -> Any: get_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore @distributed_trace_async - async def put_int(self, complex_body: Any, **kwargs: Any) -> None: + async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -494,11 +495,11 @@ async def put_int(self, complex_body: Any, **kwargs: Any) -> None: put_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore @distributed_trace_async - async def get_long(self, **kwargs: Any) -> Any: + async def get_long(self, **kwargs: Any) -> JSONType: """Get complex types with long properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -510,7 +511,7 @@ async def get_long(self, **kwargs: Any) -> Any: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -539,11 +540,11 @@ async def get_long(self, **kwargs: Any) -> Any: get_long.metadata = {"url": "/complex/primitive/long"} # type: ignore @distributed_trace_async - async def put_long(self, complex_body: Any, **kwargs: Any) -> None: + async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -585,11 +586,11 @@ async def put_long(self, complex_body: Any, **kwargs: Any) -> None: put_long.metadata = {"url": "/complex/primitive/long"} # type: ignore @distributed_trace_async - async def get_float(self, **kwargs: Any) -> Any: + async def get_float(self, **kwargs: Any) -> JSONType: """Get complex types with float properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -601,7 +602,7 @@ async def get_float(self, **kwargs: Any) -> Any: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -630,11 +631,11 @@ async def get_float(self, **kwargs: Any) -> Any: get_float.metadata = {"url": "/complex/primitive/float"} # type: ignore @distributed_trace_async - async def put_float(self, complex_body: Any, **kwargs: Any) -> None: + async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -676,11 +677,11 @@ async def put_float(self, complex_body: Any, **kwargs: Any) -> None: put_float.metadata = {"url": "/complex/primitive/float"} # type: ignore @distributed_trace_async - async def get_double(self, **kwargs: Any) -> Any: + async def get_double(self, **kwargs: Any) -> JSONType: """Get complex types with double properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -692,7 +693,7 @@ async def get_double(self, **kwargs: Any) -> Any: "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -721,12 +722,12 @@ async def get_double(self, **kwargs: Any) -> Any: get_double.metadata = {"url": "/complex/primitive/double"} # type: ignore @distributed_trace_async - async def put_double(self, complex_body: Any, **kwargs: Any) -> None: + async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and -0.000000000000000000000000000000000000000000000000000000005. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -768,11 +769,11 @@ async def put_double(self, complex_body: Any, **kwargs: Any) -> None: put_double.metadata = {"url": "/complex/primitive/double"} # type: ignore @distributed_trace_async - async def get_bool(self, **kwargs: Any) -> Any: + async def get_bool(self, **kwargs: Any) -> JSONType: """Get complex types with bool properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -784,7 +785,7 @@ async def get_bool(self, **kwargs: Any) -> Any: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -813,11 +814,11 @@ async def get_bool(self, **kwargs: Any) -> Any: get_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore @distributed_trace_async - async def put_bool(self, complex_body: Any, **kwargs: Any) -> None: + async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -859,11 +860,11 @@ async def put_bool(self, complex_body: Any, **kwargs: Any) -> None: put_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore @distributed_trace_async - async def get_string(self, **kwargs: Any) -> Any: + async def get_string(self, **kwargs: Any) -> JSONType: """Get complex types with string properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -876,7 +877,7 @@ async def get_string(self, **kwargs: Any) -> Any: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -905,11 +906,11 @@ async def get_string(self, **kwargs: Any) -> Any: get_string.metadata = {"url": "/complex/primitive/string"} # type: ignore @distributed_trace_async - async def put_string(self, complex_body: Any, **kwargs: Any) -> None: + async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -952,11 +953,11 @@ async def put_string(self, complex_body: Any, **kwargs: Any) -> None: put_string.metadata = {"url": "/complex/primitive/string"} # type: ignore @distributed_trace_async - async def get_date(self, **kwargs: Any) -> Any: + async def get_date(self, **kwargs: Any) -> JSONType: """Get complex types with date properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -968,7 +969,7 @@ async def get_date(self, **kwargs: Any) -> Any: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -997,11 +998,11 @@ async def get_date(self, **kwargs: Any) -> Any: get_date.metadata = {"url": "/complex/primitive/date"} # type: ignore @distributed_trace_async - async def put_date(self, complex_body: Any, **kwargs: Any) -> None: + async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1043,11 +1044,11 @@ async def put_date(self, complex_body: Any, **kwargs: Any) -> None: put_date.metadata = {"url": "/complex/primitive/date"} # type: ignore @distributed_trace_async - async def get_date_time(self, **kwargs: Any) -> Any: + async def get_date_time(self, **kwargs: Any) -> JSONType: """Get complex types with datetime properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1059,7 +1060,7 @@ async def get_date_time(self, **kwargs: Any) -> Any: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1088,11 +1089,11 @@ async def get_date_time(self, **kwargs: Any) -> Any: get_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore @distributed_trace_async - async def put_date_time(self, complex_body: Any, **kwargs: Any) -> None: + async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1134,11 +1135,11 @@ async def put_date_time(self, complex_body: Any, **kwargs: Any) -> None: put_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore @distributed_trace_async - async def get_date_time_rfc1123(self, **kwargs: Any) -> Any: + async def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: """Get complex types with datetimeRfc1123 properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1150,7 +1151,7 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> Any: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1179,12 +1180,12 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> Any: get_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore @distributed_trace_async - async def put_date_time_rfc1123(self, complex_body: Any, **kwargs: Any) -> None: + async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1226,11 +1227,11 @@ async def put_date_time_rfc1123(self, complex_body: Any, **kwargs: Any) -> None: put_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore @distributed_trace_async - async def get_duration(self, **kwargs: Any) -> Any: + async def get_duration(self, **kwargs: Any) -> JSONType: """Get complex types with duration properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1241,7 +1242,7 @@ async def get_duration(self, **kwargs: Any) -> Any: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1270,11 +1271,11 @@ async def get_duration(self, **kwargs: Any) -> Any: get_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore @distributed_trace_async - async def put_duration(self, complex_body: Any, **kwargs: Any) -> None: + async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with duration properties. :param complex_body: Please put 'P123DT22H14M12.011S'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1315,11 +1316,11 @@ async def put_duration(self, complex_body: Any, **kwargs: Any) -> None: put_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore @distributed_trace_async - async def get_byte(self, **kwargs: Any) -> Any: + async def get_byte(self, **kwargs: Any) -> JSONType: """Get complex types with byte properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1330,7 +1331,7 @@ async def get_byte(self, **kwargs: Any) -> Any: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1359,11 +1360,11 @@ async def get_byte(self, **kwargs: Any) -> Any: get_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore @distributed_trace_async - async def put_byte(self, complex_body: Any, **kwargs: Any) -> None: + async def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with byte properties. :param complex_body: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1423,11 +1424,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types with array property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1440,7 +1441,7 @@ async def get_valid(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1469,12 +1470,12 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/array/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with array property. :param complex_body: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog". - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1517,11 +1518,11 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/array/valid"} # type: ignore @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> Any: + async def get_empty(self, **kwargs: Any) -> JSONType: """Get complex types with array property which is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1534,7 +1535,7 @@ async def get_empty(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1563,11 +1564,11 @@ async def get_empty(self, **kwargs: Any) -> Any: get_empty.metadata = {"url": "/complex/array/empty"} # type: ignore @distributed_trace_async - async def put_empty(self, complex_body: Any, **kwargs: Any) -> None: + async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with array property which is empty. :param complex_body: Please put an empty array. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1610,11 +1611,11 @@ async def put_empty(self, complex_body: Any, **kwargs: Any) -> None: put_empty.metadata = {"url": "/complex/array/empty"} # type: ignore @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> Any: + async def get_not_provided(self, **kwargs: Any) -> JSONType: """Get complex types with array property while server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1627,7 +1628,7 @@ async def get_not_provided(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1675,11 +1676,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1692,7 +1693,7 @@ async def get_valid(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1721,12 +1722,12 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with dictionary property. :param complex_body: Please put a dictionary with 5 key-value pairs: "txt":"notepad", "bmp":"mspaint", "xls":"excel", "exe":"", "":null. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1769,11 +1770,11 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> Any: + async def get_empty(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property which is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1786,7 +1787,7 @@ async def get_empty(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1815,11 +1816,11 @@ async def get_empty(self, **kwargs: Any) -> Any: get_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore @distributed_trace_async - async def put_empty(self, complex_body: Any, **kwargs: Any) -> None: + async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types with dictionary property which is empty. :param complex_body: Please put an empty dictionary. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1862,11 +1863,11 @@ async def put_empty(self, complex_body: Any, **kwargs: Any) -> None: put_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Any: + async def get_null(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property which is null. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1879,7 +1880,7 @@ async def get_null(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1908,11 +1909,11 @@ async def get_null(self, **kwargs: Any) -> Any: get_null.metadata = {"url": "/complex/dictionary/typed/null"} # type: ignore @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> Any: + async def get_not_provided(self, **kwargs: Any) -> JSONType: """Get complex types with dictionary property while server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1925,7 +1926,7 @@ async def get_not_provided(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1973,11 +1974,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that extend others. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1998,7 +1999,7 @@ async def get_valid(self, **kwargs: Any) -> Any: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2027,13 +2028,13 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one named "Tomato" with id=-1 and food="french fries". - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2103,11 +2104,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2123,7 +2124,7 @@ async def get_valid(self, **kwargs: Any) -> Any: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2152,7 +2153,7 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -2188,7 +2189,7 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: } ] };. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2236,11 +2237,11 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: put_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore @distributed_trace_async - async def get_dot_syntax(self, **kwargs: Any) -> Any: + async def get_dot_syntax(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic, JSON key contains a dot. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2252,7 +2253,7 @@ async def get_dot_syntax(self, **kwargs: Any) -> Any: fish.type: fish.type } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2281,13 +2282,13 @@ async def get_dot_syntax(self, **kwargs: Any) -> Any: get_dot_syntax.metadata = {"url": "/complex/polymorphism/dotsyntax"} # type: ignore @distributed_trace_async - async def get_composed_with_discriminator(self, **kwargs: Any) -> Any: + async def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2321,7 +2322,7 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2350,13 +2351,13 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> Any: get_composed_with_discriminator.metadata = {"url": "/complex/polymorphism/composedWithDiscriminator"} # type: ignore @distributed_trace_async - async def get_composed_without_discriminator(self, **kwargs: Any) -> Any: + async def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2390,7 +2391,7 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2419,12 +2420,12 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> Any: get_composed_without_discriminator.metadata = {"url": "/complex/polymorphism/composedWithoutDiscriminator"} # type: ignore @distributed_trace_async - async def get_complicated(self, **kwargs: Any) -> Any: + async def get_complicated(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2449,7 +2450,7 @@ async def get_complicated(self, **kwargs: Any) -> Any: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2478,12 +2479,12 @@ async def get_complicated(self, **kwargs: Any) -> Any: get_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore @distributed_trace_async - async def put_complicated(self, complex_body: Any, **kwargs: Any) -> None: + async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2540,13 +2541,13 @@ async def put_complicated(self, complex_body: Any, **kwargs: Any) -> None: put_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore @distributed_trace_async - async def put_missing_discriminator(self, complex_body: Any, **kwargs: Any) -> Any: + async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JSONType: """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2592,7 +2593,7 @@ async def put_missing_discriminator(self, complex_body: Any, **kwargs: Any) -> A fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2627,7 +2628,7 @@ async def put_missing_discriminator(self, complex_body: Any, **kwargs: Any) -> A put_missing_discriminator.metadata = {"url": "/complex/polymorphism/missingdiscriminator"} # type: ignore @distributed_trace_async - async def put_valid_missing_required(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -2658,7 +2659,7 @@ async def put_valid_missing_required(self, complex_body: Any, **kwargs: Any) -> } ] }. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2725,11 +2726,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that are polymorphic and have recursive references. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2745,7 +2746,7 @@ async def get_valid(self, **kwargs: Any) -> Any: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2774,7 +2775,7 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -2830,7 +2831,7 @@ async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: } ] }. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2897,11 +2898,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """Get complex types that have readonly properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2913,7 +2914,7 @@ async def get_valid(self, **kwargs: Any) -> Any: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2942,11 +2943,11 @@ async def get_valid(self, **kwargs: Any) -> Any: get_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore @distributed_trace_async - async def put_valid(self, complex_body: Any, **kwargs: Any) -> None: + async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: """Put complex types that have readonly properties. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3007,11 +3008,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> Any: + async def get_valid(self, **kwargs: Any) -> JSONType: """get_valid. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3026,7 +3027,7 @@ async def get_valid(self, **kwargs: Any) -> Any: kind: kind } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py index 69740bc3dbc..554e1a0e840 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -1252,11 +1253,11 @@ def __init__(self, client, config, serializer, deserializer): def get_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1269,7 +1270,7 @@ def get_valid( "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1300,14 +1301,14 @@ def get_valid( @distributed_trace def put_valid( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. - :type complex_body: Any + :type complex_body: JSONType :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -1358,11 +1359,11 @@ def put_valid( def get_invalid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a basic complex type that is invalid for the local strong type. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1375,7 +1376,7 @@ def get_invalid( "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1407,11 +1408,11 @@ def get_invalid( def get_empty( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a basic complex type that is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1424,7 +1425,7 @@ def get_empty( "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1456,11 +1457,11 @@ def get_empty( def get_null( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a basic complex type whose properties are null. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1473,7 +1474,7 @@ def get_null( "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1505,11 +1506,11 @@ def get_null( def get_not_provided( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a basic complex type while the server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1522,7 +1523,7 @@ def get_not_provided( "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1573,11 +1574,11 @@ def __init__(self, client, config, serializer, deserializer): def get_int( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with integer properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1589,7 +1590,7 @@ def get_int( "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1620,14 +1621,14 @@ def get_int( @distributed_trace def put_int( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with integer properties. :param complex_body: Please put -1 and 2. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1672,11 +1673,11 @@ def put_int( def get_long( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with long properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1688,7 +1689,7 @@ def get_long( "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1719,14 +1720,14 @@ def get_long( @distributed_trace def put_long( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1771,11 +1772,11 @@ def put_long( def get_float( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with float properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1787,7 +1788,7 @@ def get_float( "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1818,14 +1819,14 @@ def get_float( @distributed_trace def put_float( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1870,11 +1871,11 @@ def put_float( def get_double( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with double properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1886,7 +1887,7 @@ def get_double( "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1917,7 +1918,7 @@ def get_double( @distributed_trace def put_double( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -1925,7 +1926,7 @@ def put_double( :param complex_body: Please put 3e-100 and -0.000000000000000000000000000000000000000000000000000000005. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1970,11 +1971,11 @@ def put_double( def get_bool( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with bool properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1986,7 +1987,7 @@ def get_bool( "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2017,14 +2018,14 @@ def get_bool( @distributed_trace def put_bool( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with bool properties. :param complex_body: Please put true and false. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2069,11 +2070,11 @@ def put_bool( def get_string( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with string properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2086,7 +2087,7 @@ def get_string( "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2117,14 +2118,14 @@ def get_string( @distributed_trace def put_string( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2170,11 +2171,11 @@ def put_string( def get_date( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with date properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2186,7 +2187,7 @@ def get_date( "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2217,14 +2218,14 @@ def get_date( @distributed_trace def put_date( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2269,11 +2270,11 @@ def put_date( def get_date_time( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with datetime properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2285,7 +2286,7 @@ def get_date_time( "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2316,14 +2317,14 @@ def get_date_time( @distributed_trace def put_date_time( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2368,11 +2369,11 @@ def put_date_time( def get_date_time_rfc1123( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with datetimeRfc1123 properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2384,7 +2385,7 @@ def get_date_time_rfc1123( "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2415,7 +2416,7 @@ def get_date_time_rfc1123( @distributed_trace def put_date_time_rfc1123( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -2423,7 +2424,7 @@ def put_date_time_rfc1123( :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2468,11 +2469,11 @@ def put_date_time_rfc1123( def get_duration( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with duration properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2483,7 +2484,7 @@ def get_duration( "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2514,14 +2515,14 @@ def get_duration( @distributed_trace def put_duration( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with duration properties. :param complex_body: Please put 'P123DT22H14M12.011S'. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2565,11 +2566,11 @@ def put_duration( def get_byte( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with byte properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2580,7 +2581,7 @@ def get_byte( "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2611,14 +2612,14 @@ def get_byte( @distributed_trace def put_byte( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with byte properties. :param complex_body: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2681,11 +2682,11 @@ def __init__(self, client, config, serializer, deserializer): def get_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with array property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2698,7 +2699,7 @@ def get_valid( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2729,7 +2730,7 @@ def get_valid( @distributed_trace def put_valid( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -2737,7 +2738,7 @@ def put_valid( :param complex_body: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog". - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2783,11 +2784,11 @@ def put_valid( def get_empty( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with array property which is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2800,7 +2801,7 @@ def get_empty( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2831,14 +2832,14 @@ def get_empty( @distributed_trace def put_empty( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with array property which is empty. :param complex_body: Please put an empty array. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2884,11 +2885,11 @@ def put_empty( def get_not_provided( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with array property while server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2901,7 +2902,7 @@ def get_not_provided( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2952,11 +2953,11 @@ def __init__(self, client, config, serializer, deserializer): def get_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with dictionary property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2969,7 +2970,7 @@ def get_valid( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3000,7 +3001,7 @@ def get_valid( @distributed_trace def put_valid( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -3008,7 +3009,7 @@ def put_valid( :param complex_body: Please put a dictionary with 5 key-value pairs: "txt":"notepad", "bmp":"mspaint", "xls":"excel", "exe":"", "":null. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3054,11 +3055,11 @@ def put_valid( def get_empty( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with dictionary property which is empty. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3071,7 +3072,7 @@ def get_empty( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3102,14 +3103,14 @@ def get_empty( @distributed_trace def put_empty( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types with dictionary property which is empty. :param complex_body: Please put an empty dictionary. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3155,11 +3156,11 @@ def put_empty( def get_null( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with dictionary property which is null. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3172,7 +3173,7 @@ def get_null( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3204,11 +3205,11 @@ def get_null( def get_not_provided( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types with dictionary property while server doesn't provide a response payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3221,7 +3222,7 @@ def get_not_provided( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3272,11 +3273,11 @@ def __init__(self, client, config, serializer, deserializer): def get_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types that extend others. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3297,7 +3298,7 @@ def get_valid( "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3328,7 +3329,7 @@ def get_valid( @distributed_trace def put_valid( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -3337,7 +3338,7 @@ def put_valid( :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one named "Tomato" with id=-1 and food="french fries". - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3410,11 +3411,11 @@ def __init__(self, client, config, serializer, deserializer): def get_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types that are polymorphic. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3430,7 +3431,7 @@ def get_valid( fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3461,7 +3462,7 @@ def get_valid( @distributed_trace def put_valid( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -3500,7 +3501,7 @@ def put_valid( } ] };. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3551,11 +3552,11 @@ def put_valid( def get_dot_syntax( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types that are polymorphic, JSON key contains a dot. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3567,7 +3568,7 @@ def get_dot_syntax( fish.type: fish.type } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3599,13 +3600,13 @@ def get_dot_syntax( def get_composed_with_discriminator( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3639,7 +3640,7 @@ def get_composed_with_discriminator( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3671,13 +3672,13 @@ def get_composed_with_discriminator( def get_composed_without_discriminator( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3711,7 +3712,7 @@ def get_composed_without_discriminator( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3743,12 +3744,12 @@ def get_composed_without_discriminator( def get_complicated( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3773,7 +3774,7 @@ def get_complicated( fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3804,7 +3805,7 @@ def get_complicated( @distributed_trace def put_complicated( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -3812,7 +3813,7 @@ def put_complicated( additional properties. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -3871,16 +3872,16 @@ def put_complicated( @distributed_trace def put_missing_discriminator( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3926,7 +3927,7 @@ def put_missing_discriminator( fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3963,7 +3964,7 @@ def put_missing_discriminator( @distributed_trace def put_valid_missing_required( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -3997,7 +3998,7 @@ def put_valid_missing_required( } ] }. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -4067,11 +4068,11 @@ def __init__(self, client, config, serializer, deserializer): def get_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types that are polymorphic and have recursive references. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4087,7 +4088,7 @@ def get_valid( fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4118,7 +4119,7 @@ def get_valid( @distributed_trace def put_valid( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -4177,7 +4178,7 @@ def put_valid( } ] }. - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -4247,11 +4248,11 @@ def __init__(self, client, config, serializer, deserializer): def get_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get complex types that have readonly properties. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4263,7 +4264,7 @@ def get_valid( "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4294,14 +4295,14 @@ def get_valid( @distributed_trace def put_valid( self, - complex_body, # type: Any + complex_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put complex types that have readonly properties. :param complex_body: - :type complex_body: Any + :type complex_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -4365,11 +4366,11 @@ def __init__(self, client, config, serializer, deserializer): def get_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """get_valid. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4384,7 +4385,7 @@ def get_valid( kind: kind } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py index 899183a9818..d24381ea4dc 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py @@ -35,6 +35,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py index c96359b60de..84415d2e484 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py index ba10a8bce5b..53a01e141ad 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py @@ -48,6 +48,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py index 92305332e90..583c7f4fde6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py index 4c8c22abcbd..3d8188ce111 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py @@ -34,6 +34,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py index 87c6b21d4a9..13857381176 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py index cd9da05f041..c309d4fd973 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py @@ -91,6 +91,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -2201,11 +2202,11 @@ async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: get_base64_url.metadata = {"url": "/dictionary/prim/base64url/valid"} # type: ignore @distributed_trace_async - async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, Any]]: + async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSONType]]: """Get dictionary of complex type null value. :return: dict mapping str to JSON object or None - :rtype: dict[str, Any] or None + :rtype: dict[str, JSONType] or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2219,7 +2220,7 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, Any]]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, Any]]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, JSONType]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2248,11 +2249,11 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, Any]]: get_complex_null.metadata = {"url": "/dictionary/complex/null"} # type: ignore @distributed_trace_async - async def get_complex_empty(self, **kwargs: Any) -> Dict[str, Any]: + async def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSONType]: """Get empty dictionary of complex type {}. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2266,7 +2267,7 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, Any]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2295,12 +2296,12 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, Any]: get_complex_empty.metadata = {"url": "/dictionary/complex/empty"} # type: ignore @distributed_trace_async - async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, Any]: + async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSONType]: """Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, "2": {"integer": 5, "string": "6"}}. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2314,7 +2315,7 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, Any]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2343,12 +2344,12 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, Any]: get_complex_item_null.metadata = {"url": "/dictionary/complex/itemnull"} # type: ignore @distributed_trace_async - async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, Any]: + async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSONType]: """Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}}. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2362,7 +2363,7 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, Any]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2391,12 +2392,12 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, Any]: get_complex_item_empty.metadata = {"url": "/dictionary/complex/itemempty"} # type: ignore @distributed_trace_async - async def get_complex_valid(self, **kwargs: Any) -> Dict[str, Any]: + async def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSONType]: """Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2410,7 +2411,7 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, Any]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2439,12 +2440,12 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, Any]: get_complex_valid.metadata = {"url": "/dictionary/complex/valid"} # type: ignore @distributed_trace_async - async def put_complex_valid(self, array_body: Dict[str, Any], **kwargs: Any) -> None: + async def put_complex_valid(self, array_body: Dict[str, JSONType], **kwargs: Any) -> None: """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. :param array_body: - :type array_body: dict[str, Any] + :type array_body: dict[str, JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py index 2aec133352a..0c4c4bf47da 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -3668,11 +3669,11 @@ def get_base64_url( def get_complex_null( self, **kwargs # type: Any ): - # type: (...) -> Optional[Dict[str, Any]] + # type: (...) -> Optional[Dict[str, JSONType]] """Get dictionary of complex type null value. :return: dict mapping str to JSON object or None - :rtype: dict[str, Any] or None + :rtype: dict[str, JSONType] or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3686,7 +3687,7 @@ def get_complex_null( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, Any]]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, JSONType]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3718,11 +3719,11 @@ def get_complex_null( def get_complex_empty( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, Any] + # type: (...) -> Dict[str, JSONType] """Get empty dictionary of complex type {}. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3736,7 +3737,7 @@ def get_complex_empty( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3768,12 +3769,12 @@ def get_complex_empty( def get_complex_item_null( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, Any] + # type: (...) -> Dict[str, JSONType] """Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, "2": {"integer": 5, "string": "6"}}. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3787,7 +3788,7 @@ def get_complex_item_null( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3819,12 +3820,12 @@ def get_complex_item_null( def get_complex_item_empty( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, Any] + # type: (...) -> Dict[str, JSONType] """Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}}. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3838,7 +3839,7 @@ def get_complex_item_empty( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3870,12 +3871,12 @@ def get_complex_item_empty( def get_complex_valid( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, Any] + # type: (...) -> Dict[str, JSONType] """Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3889,7 +3890,7 @@ def get_complex_valid( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3920,7 +3921,7 @@ def get_complex_valid( @distributed_trace def put_complex_valid( self, - array_body, # type: Dict[str, Any] + array_body, # type: Dict[str, JSONType] **kwargs # type: Any ): # type: (...) -> None @@ -3928,7 +3929,7 @@ def put_complex_valid( {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. :param array_body: - :type array_body: dict[str, Any] + :type array_body: dict[str, JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py index 2c86b4d91c3..65a5648e427 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py @@ -30,6 +30,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py index d1a41e3f0fa..9d73e0763de 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py index 47b73eab405..bad794e2f95 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py @@ -28,6 +28,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py index d7959117c11..fe68b793884 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py index 4104dfd844f..04687df0742 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py @@ -28,6 +28,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py index 4fe501126a8..b62a23c21b7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py index 4a633e13d7e..954f8387242 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py @@ -27,6 +27,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py index 8c54bfc4842..4e300421be8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py @@ -29,6 +29,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py index cca39c08ce1..8343c62701b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py @@ -40,6 +40,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py index 8bd52ea660b..a8dcdbcbc68 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py index effcd79bce5..d992efd0485 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py @@ -49,6 +49,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py index 212802cacf7..07f178e8ffa 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py index 4035ee4a847..4a20bcecb6f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py @@ -44,6 +44,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -731,11 +732,11 @@ async def put_referenced(self, enum_string_body: str, **kwargs: Any) -> None: put_referenced.metadata = {"url": "/string/enum/Referenced"} # type: ignore @distributed_trace_async - async def get_referenced_constant(self, **kwargs: Any) -> Any: + async def get_referenced_constant(self, **kwargs: Any) -> JSONType: """Get value 'green-color' from the constant. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -747,7 +748,7 @@ async def get_referenced_constant(self, **kwargs: Any) -> Any: "field1": "str" # Optional. Sample string. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -776,11 +777,11 @@ async def get_referenced_constant(self, **kwargs: Any) -> Any: get_referenced_constant.metadata = {"url": "/string/enum/ReferencedConstant"} # type: ignore @distributed_trace_async - async def put_referenced_constant(self, enum_string_body: Any, **kwargs: Any) -> None: + async def put_referenced_constant(self, enum_string_body: JSONType, **kwargs: Any) -> None: """Sends value 'green-color' from a constant. :param enum_string_body: enum string body. - :type enum_string_body: Any + :type enum_string_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py index 4fb43f3e3d1..6274bcf2741 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -1196,11 +1197,11 @@ def put_referenced( def get_referenced_constant( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get value 'green-color' from the constant. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1212,7 +1213,7 @@ def get_referenced_constant( "field1": "str" # Optional. Sample string. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1243,14 +1244,14 @@ def get_referenced_constant( @distributed_trace def put_referenced_constant( self, - enum_string_body, # type: Any + enum_string_body, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Sends value 'green-color' from a constant. :param enum_string_body: enum string body. - :type enum_string_body: Any + :type enum_string_body: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py index ef42aedca08..0e193b82096 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py @@ -25,6 +25,7 @@ from ...operations._operations import build_time_get_request, build_time_put_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py index 9bcd774abb4..d8240b3eb6a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py index b0f7984ba61..3a33ab59005 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import build_pet_add_pet_request, build_pet_get_by_pet_id_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -46,13 +47,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> Any: + async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSONType: """get pet by id. :param pet_id: Pet id. :type pet_id: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -65,7 +66,7 @@ async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> Any: "name": "str" # Optional. name. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -95,13 +96,13 @@ async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> Any: get_by_pet_id.metadata = {"url": "/extensibleenums/pet/{petId}"} # type: ignore @distributed_trace_async - async def add_pet(self, pet_param: Any = None, **kwargs: Any) -> Any: + async def add_pet(self, pet_param: JSONType = None, **kwargs: Any) -> JSONType: """add pet. :param pet_param: pet param. - :type pet_param: Any + :type pet_param: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -121,7 +122,7 @@ async def add_pet(self, pet_param: Any = None, **kwargs: Any) -> Any: "name": "str" # Optional. name. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py index 44d3003fdb1..0cb1ec0fb06 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py @@ -29,6 +29,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -108,13 +109,13 @@ def get_by_pet_id( pet_id, # type: str **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """get pet by id. :param pet_id: Pet id. :type pet_id: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -127,7 +128,7 @@ def get_by_pet_id( "name": "str" # Optional. name. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -159,16 +160,16 @@ def get_by_pet_id( @distributed_trace def add_pet( self, - pet_param=None, # type: Any + pet_param=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """add pet. :param pet_param: pet param. - :type pet_param: Any + :type pet_param: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -188,7 +189,7 @@ def add_pet( "name": "str" # Optional. name. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py index 2dc4796689d..725b4e43f2e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py @@ -136,6 +136,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -3090,11 +3091,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) -> Optional[Any]: + async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) -> Optional[JSONType]: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3105,7 +3106,7 @@ async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) - "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3136,11 +3137,11 @@ async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) - get200_model204_no_model_default_error200_valid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/200/valid"} # type: ignore @distributed_trace_async - async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) -> Optional[Any]: + async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) -> Optional[JSONType]: """Send a 204 response with no payload. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3151,7 +3152,7 @@ async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) - "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3182,11 +3183,11 @@ async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) - get200_model204_no_model_default_error204_valid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/204/none"} # type: ignore @distributed_trace_async - async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) -> Optional[Any]: + async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) -> Optional[JSONType]: """Send a 201 response with valid payload: {'statusCode': '201'}. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3197,7 +3198,7 @@ async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3228,11 +3229,11 @@ async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) get200_model204_no_model_default_error201_invalid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/201/valid"} # type: ignore @distributed_trace_async - async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> Optional[Any]: + async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> Optional[JSONType]: """Send a 202 response with no payload:. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3243,7 +3244,7 @@ async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3274,11 +3275,11 @@ async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> get200_model204_no_model_default_error202_none.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/202/none"} # type: ignore @distributed_trace_async - async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) -> Optional[Any]: + async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) -> Optional[JSONType]: """Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'}. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3289,7 +3290,7 @@ async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) - "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3320,11 +3321,11 @@ async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) - get200_model204_no_model_default_error400_valid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/400/valid"} # type: ignore @distributed_trace_async - async def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> Any: + async def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> JSONType: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3340,7 +3341,7 @@ async def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> A "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3376,11 +3377,11 @@ async def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> A get200_model201_model_default_error200_valid.metadata = {"url": "/http/payloads/200/A/201/B/default/Error/response/200/valid"} # type: ignore @distributed_trace_async - async def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> Any: + async def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> JSONType: """Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3396,7 +3397,7 @@ async def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> A "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3432,11 +3433,11 @@ async def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> A get200_model201_model_default_error201_valid.metadata = {"url": "/http/payloads/200/A/201/B/default/Error/response/201/valid"} # type: ignore @distributed_trace_async - async def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> Any: + async def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> JSONType: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3452,7 +3453,7 @@ async def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> A "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3488,11 +3489,11 @@ async def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> A get200_model201_model_default_error400_valid.metadata = {"url": "/http/payloads/200/A/201/B/default/Error/response/400/valid"} # type: ignore @distributed_trace_async - async def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kwargs: Any) -> Any: + async def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kwargs: Any) -> JSONType: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3511,7 +3512,7 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kw "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3553,11 +3554,11 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kw get200_model_a201_model_c404_model_d_default_error200_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid"} # type: ignore @distributed_trace_async - async def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kwargs: Any) -> Any: + async def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kwargs: Any) -> JSONType: """Send a 200 response with valid payload: {'httpCode': '201'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3576,7 +3577,7 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kw "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3618,11 +3619,11 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kw get200_model_a201_model_c404_model_d_default_error201_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid"} # type: ignore @distributed_trace_async - async def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kwargs: Any) -> Any: + async def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kwargs: Any) -> JSONType: """Send a 200 response with valid payload: {'httpStatusCode': '404'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3641,7 +3642,7 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kw "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3683,11 +3684,11 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kw get200_model_a201_model_c404_model_d_default_error404_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid"} # type: ignore @distributed_trace_async - async def get200_model_a201_model_c404_model_d_default_error400_valid(self, **kwargs: Any) -> Any: + async def get200_model_a201_model_c404_model_d_default_error400_valid(self, **kwargs: Any) -> JSONType: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3706,7 +3707,7 @@ async def get200_model_a201_model_c404_model_d_default_error400_valid(self, **kw "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3951,11 +3952,11 @@ async def get202_none204_none_default_none400_invalid(self, **kwargs: Any) -> No get202_none204_none_default_none400_invalid.metadata = {"url": "/http/payloads/202/none/204/none/default/none/response/400/invalid"} # type: ignore @distributed_trace_async - async def get_default_model_a200_valid(self, **kwargs: Any) -> Any: + async def get_default_model_a200_valid(self, **kwargs: Any) -> JSONType: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -3966,7 +3967,7 @@ async def get_default_model_a200_valid(self, **kwargs: Any) -> Any: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -3995,11 +3996,11 @@ async def get_default_model_a200_valid(self, **kwargs: Any) -> Any: get_default_model_a200_valid.metadata = {"url": "/http/payloads/default/A/response/200/valid"} # type: ignore @distributed_trace_async - async def get_default_model_a200_none(self, **kwargs: Any) -> Any: + async def get_default_model_a200_none(self, **kwargs: Any) -> JSONType: """Send a 200 response with no payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4010,7 +4011,7 @@ async def get_default_model_a200_none(self, **kwargs: Any) -> Any: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4213,12 +4214,12 @@ async def get_default_none400_none(self, **kwargs: Any) -> None: get_default_none400_none.metadata = {"url": "/http/payloads/default/none/response/400/none"} # type: ignore @distributed_trace_async - async def get200_model_a200_none(self, **kwargs: Any) -> Any: + async def get200_model_a200_none(self, **kwargs: Any) -> JSONType: """Send a 200 response with no payload, when a payload is expected - client should return a null object of thde type for model A. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4229,7 +4230,7 @@ async def get200_model_a200_none(self, **kwargs: Any) -> Any: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4258,11 +4259,11 @@ async def get200_model_a200_none(self, **kwargs: Any) -> Any: get200_model_a200_none.metadata = {"url": "/http/payloads/200/A/response/200/none"} # type: ignore @distributed_trace_async - async def get200_model_a200_valid(self, **kwargs: Any) -> Any: + async def get200_model_a200_valid(self, **kwargs: Any) -> JSONType: """Send a 200 response with payload {'statusCode': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4273,7 +4274,7 @@ async def get200_model_a200_valid(self, **kwargs: Any) -> Any: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4302,11 +4303,11 @@ async def get200_model_a200_valid(self, **kwargs: Any) -> Any: get200_model_a200_valid.metadata = {"url": "/http/payloads/200/A/response/200/valid"} # type: ignore @distributed_trace_async - async def get200_model_a200_invalid(self, **kwargs: Any) -> Any: + async def get200_model_a200_invalid(self, **kwargs: Any) -> JSONType: """Send a 200 response with invalid payload {'statusCodeInvalid': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4317,7 +4318,7 @@ async def get200_model_a200_invalid(self, **kwargs: Any) -> Any: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4346,11 +4347,11 @@ async def get200_model_a200_invalid(self, **kwargs: Any) -> Any: get200_model_a200_invalid.metadata = {"url": "/http/payloads/200/A/response/200/invalid"} # type: ignore @distributed_trace_async - async def get200_model_a400_none(self, **kwargs: Any) -> Any: + async def get200_model_a400_none(self, **kwargs: Any) -> JSONType: """Send a 400 response with no payload client should treat as an http error with no error model. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4361,7 +4362,7 @@ async def get200_model_a400_none(self, **kwargs: Any) -> Any: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4390,11 +4391,11 @@ async def get200_model_a400_none(self, **kwargs: Any) -> Any: get200_model_a400_none.metadata = {"url": "/http/payloads/200/A/response/400/none"} # type: ignore @distributed_trace_async - async def get200_model_a400_valid(self, **kwargs: Any) -> Any: + async def get200_model_a400_valid(self, **kwargs: Any) -> JSONType: """Send a 200 response with payload {'statusCode': '400'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4405,7 +4406,7 @@ async def get200_model_a400_valid(self, **kwargs: Any) -> Any: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4434,11 +4435,11 @@ async def get200_model_a400_valid(self, **kwargs: Any) -> Any: get200_model_a400_valid.metadata = {"url": "/http/payloads/200/A/response/400/valid"} # type: ignore @distributed_trace_async - async def get200_model_a400_invalid(self, **kwargs: Any) -> Any: + async def get200_model_a400_invalid(self, **kwargs: Any) -> JSONType: """Send a 200 response with invalid payload {'statusCodeInvalid': '400'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4449,7 +4450,7 @@ async def get200_model_a400_invalid(self, **kwargs: Any) -> Any: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -4478,11 +4479,11 @@ async def get200_model_a400_invalid(self, **kwargs: Any) -> Any: get200_model_a400_invalid.metadata = {"url": "/http/payloads/200/A/response/400/invalid"} # type: ignore @distributed_trace_async - async def get200_model_a202_valid(self, **kwargs: Any) -> Any: + async def get200_model_a202_valid(self, **kwargs: Any) -> JSONType: """Send a 202 response with payload {'statusCode': '202'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -4493,7 +4494,7 @@ async def get200_model_a202_valid(self, **kwargs: Any) -> Any: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py index dc56ae488c3..5be382f0704 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -5641,11 +5642,11 @@ def __init__(self, client, config, serializer, deserializer): def get200_model204_no_model_default_error200_valid( self, **kwargs # type: Any ): - # type: (...) -> Optional[Any] + # type: (...) -> Optional[JSONType] """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5656,7 +5657,7 @@ def get200_model204_no_model_default_error200_valid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5690,11 +5691,11 @@ def get200_model204_no_model_default_error200_valid( def get200_model204_no_model_default_error204_valid( self, **kwargs # type: Any ): - # type: (...) -> Optional[Any] + # type: (...) -> Optional[JSONType] """Send a 204 response with no payload. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5705,7 +5706,7 @@ def get200_model204_no_model_default_error204_valid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5739,11 +5740,11 @@ def get200_model204_no_model_default_error204_valid( def get200_model204_no_model_default_error201_invalid( self, **kwargs # type: Any ): - # type: (...) -> Optional[Any] + # type: (...) -> Optional[JSONType] """Send a 201 response with valid payload: {'statusCode': '201'}. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5754,7 +5755,7 @@ def get200_model204_no_model_default_error201_invalid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5788,11 +5789,11 @@ def get200_model204_no_model_default_error201_invalid( def get200_model204_no_model_default_error202_none( self, **kwargs # type: Any ): - # type: (...) -> Optional[Any] + # type: (...) -> Optional[JSONType] """Send a 202 response with no payload:. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5803,7 +5804,7 @@ def get200_model204_no_model_default_error202_none( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5837,11 +5838,11 @@ def get200_model204_no_model_default_error202_none( def get200_model204_no_model_default_error400_valid( self, **kwargs # type: Any ): - # type: (...) -> Optional[Any] + # type: (...) -> Optional[JSONType] """Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'}. :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5852,7 +5853,7 @@ def get200_model204_no_model_default_error400_valid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5886,11 +5887,11 @@ def get200_model204_no_model_default_error400_valid( def get200_model201_model_default_error200_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5906,7 +5907,7 @@ def get200_model201_model_default_error200_valid( "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -5945,11 +5946,11 @@ def get200_model201_model_default_error200_valid( def get200_model201_model_default_error201_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -5965,7 +5966,7 @@ def get200_model201_model_default_error201_valid( "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6004,11 +6005,11 @@ def get200_model201_model_default_error201_valid( def get200_model201_model_default_error400_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6024,7 +6025,7 @@ def get200_model201_model_default_error400_valid( "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6063,11 +6064,11 @@ def get200_model201_model_default_error400_valid( def get200_model_a201_model_c404_model_d_default_error200_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6086,7 +6087,7 @@ def get200_model_a201_model_c404_model_d_default_error200_valid( "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6131,11 +6132,11 @@ def get200_model_a201_model_c404_model_d_default_error200_valid( def get200_model_a201_model_c404_model_d_default_error201_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with valid payload: {'httpCode': '201'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6154,7 +6155,7 @@ def get200_model_a201_model_c404_model_d_default_error201_valid( "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6199,11 +6200,11 @@ def get200_model_a201_model_c404_model_d_default_error201_valid( def get200_model_a201_model_c404_model_d_default_error404_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with valid payload: {'httpStatusCode': '404'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6222,7 +6223,7 @@ def get200_model_a201_model_c404_model_d_default_error404_valid( "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6267,11 +6268,11 @@ def get200_model_a201_model_c404_model_d_default_error404_valid( def get200_model_a201_model_c404_model_d_default_error400_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6290,7 +6291,7 @@ def get200_model_a201_model_c404_model_d_default_error400_valid( "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6559,11 +6560,11 @@ def get202_none204_none_default_none400_invalid( def get_default_model_a200_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6574,7 +6575,7 @@ def get_default_model_a200_valid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6606,11 +6607,11 @@ def get_default_model_a200_valid( def get_default_model_a200_none( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with no payload. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6621,7 +6622,7 @@ def get_default_model_a200_none( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6845,12 +6846,12 @@ def get_default_none400_none( def get200_model_a200_none( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with no payload, when a payload is expected - client should return a null object of thde type for model A. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6861,7 +6862,7 @@ def get200_model_a200_none( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6893,11 +6894,11 @@ def get200_model_a200_none( def get200_model_a200_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with payload {'statusCode': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6908,7 +6909,7 @@ def get200_model_a200_valid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6940,11 +6941,11 @@ def get200_model_a200_valid( def get200_model_a200_invalid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with invalid payload {'statusCodeInvalid': '200'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -6955,7 +6956,7 @@ def get200_model_a200_invalid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -6987,11 +6988,11 @@ def get200_model_a200_invalid( def get200_model_a400_none( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 400 response with no payload client should treat as an http error with no error model. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7002,7 +7003,7 @@ def get200_model_a400_none( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7034,11 +7035,11 @@ def get200_model_a400_none( def get200_model_a400_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with payload {'statusCode': '400'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7049,7 +7050,7 @@ def get200_model_a400_valid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7081,11 +7082,11 @@ def get200_model_a400_valid( def get200_model_a400_invalid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 200 response with invalid payload {'statusCodeInvalid': '400'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7096,7 +7097,7 @@ def get200_model_a400_invalid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -7128,11 +7129,11 @@ def get200_model_a400_invalid( def get200_model_a202_valid( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Send a 202 response with payload {'statusCode': '202'}. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -7143,7 +7144,7 @@ def get200_model_a202_valid( "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py index a7000db6311..5a7999ba12d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py @@ -31,16 +31,17 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MediaTypesClientOperationsMixin: @distributed_trace_async - async def analyze_body(self, input: Optional[Union[IO, Any]] = None, **kwargs: Any) -> str: + async def analyze_body(self, input: Optional[Union[IO, JSONType]] = None, **kwargs: Any) -> str: """Analyze body, that could be different media types. :param input: Input parameter. - :type input: IO or Any + :type input: IO or JSONType :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json." @@ -103,12 +104,12 @@ async def analyze_body(self, input: Optional[Union[IO, Any]] = None, **kwargs: A analyze_body.metadata = {"url": "/mediatypes/analyze"} # type: ignore @distributed_trace_async - async def analyze_body_no_accept_header(self, input: Optional[Union[IO, Any]] = None, **kwargs: Any) -> None: + async def analyze_body_no_accept_header(self, input: Optional[Union[IO, JSONType]] = None, **kwargs: Any) -> None: """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type. :param input: Input parameter. - :type input: IO or Any + :type input: IO or JSONType :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json." diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py index 8e39979511d..08b85183f51 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -178,14 +179,14 @@ class MediaTypesClientOperationsMixin(object): @distributed_trace def analyze_body( self, - input=None, # type: Optional[Union[IO, Any]] + input=None, # type: Optional[Union[IO, JSONType]] **kwargs # type: Any ): # type: (...) -> str """Analyze body, that could be different media types. :param input: Input parameter. - :type input: IO or Any + :type input: IO or JSONType :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json." @@ -250,7 +251,7 @@ def analyze_body( @distributed_trace def analyze_body_no_accept_header( self, - input=None, # type: Optional[Union[IO, Any]] + input=None, # type: Optional[Union[IO, JSONType]] **kwargs # type: Any ): # type: (...) -> None @@ -258,7 +259,7 @@ def analyze_body_no_accept_header( type. :param input: Input parameter. - :type input: IO or Any + :type input: IO or JSONType :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json." diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/operations/_operations.py index 9d34b33fd5e..7f15e2da0d2 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/operations/_operations.py @@ -36,16 +36,17 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AutoRestResourceFlatteningTestServiceOperationsMixin: @distributed_trace_async - async def put_array(self, resource_array: Optional[List[Any]] = None, **kwargs: Any) -> None: + async def put_array(self, resource_array: Optional[List[JSONType]] = None, **kwargs: Any) -> None: """Put External Resource as an Array. :param resource_array: External Resource as an Array to put. - :type resource_array: list[Any] + :type resource_array: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -97,11 +98,11 @@ async def put_array(self, resource_array: Optional[List[Any]] = None, **kwargs: put_array.metadata = {"url": "/model-flatten/array"} # type: ignore @distributed_trace_async - async def get_array(self, **kwargs: Any) -> List[Any]: + async def get_array(self, **kwargs: Any) -> List[JSONType]: """Get External Resource as an Array. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -126,7 +127,7 @@ async def get_array(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -155,12 +156,12 @@ async def get_array(self, **kwargs: Any) -> List[Any]: get_array.metadata = {"url": "/model-flatten/array"} # type: ignore @distributed_trace_async - async def put_wrapped_array(self, resource_array: Optional[List[Any]] = None, **kwargs: Any) -> None: + async def put_wrapped_array(self, resource_array: Optional[List[JSONType]] = None, **kwargs: Any) -> None: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. :param resource_array: External Resource as an Array to put. - :type resource_array: list[Any] + :type resource_array: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -206,12 +207,12 @@ async def put_wrapped_array(self, resource_array: Optional[List[Any]] = None, ** put_wrapped_array.metadata = {"url": "/model-flatten/wrappedarray"} # type: ignore @distributed_trace_async - async def get_wrapped_array(self, **kwargs: Any) -> List[Any]: + async def get_wrapped_array(self, **kwargs: Any) -> List[JSONType]: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -226,7 +227,7 @@ async def get_wrapped_array(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -255,11 +256,11 @@ async def get_wrapped_array(self, **kwargs: Any) -> List[Any]: get_wrapped_array.metadata = {"url": "/model-flatten/wrappedarray"} # type: ignore @distributed_trace_async - async def put_dictionary(self, resource_dictionary: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: + async def put_dictionary(self, resource_dictionary: Optional[Dict[str, JSONType]] = None, **kwargs: Any) -> None: """Put External Resource as a Dictionary. :param resource_dictionary: External Resource as a Dictionary to put. - :type resource_dictionary: dict[str, Any] + :type resource_dictionary: dict[str, JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -317,11 +318,11 @@ async def put_dictionary(self, resource_dictionary: Optional[Dict[str, Any]] = N put_dictionary.metadata = {"url": "/model-flatten/dictionary"} # type: ignore @distributed_trace_async - async def get_dictionary(self, **kwargs: Any) -> Dict[str, Any]: + async def get_dictionary(self, **kwargs: Any) -> Dict[str, JSONType]: """Get External Resource as a Dictionary. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -346,7 +347,7 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, Any]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -375,11 +376,11 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, Any]: get_dictionary.metadata = {"url": "/model-flatten/dictionary"} # type: ignore @distributed_trace_async - async def put_resource_collection(self, resource_complex_object: Any = None, **kwargs: Any) -> None: + async def put_resource_collection(self, resource_complex_object: JSONType = None, **kwargs: Any) -> None: """Put External Resource as a ResourceCollection. :param resource_complex_object: External Resource as a ResourceCollection to put. - :type resource_complex_object: Any + :type resource_complex_object: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -471,11 +472,11 @@ async def put_resource_collection(self, resource_complex_object: Any = None, **k put_resource_collection.metadata = {"url": "/model-flatten/resourcecollection"} # type: ignore @distributed_trace_async - async def get_resource_collection(self, **kwargs: Any) -> Any: + async def get_resource_collection(self, **kwargs: Any) -> JSONType: """Get External Resource as a ResourceCollection. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -534,7 +535,7 @@ async def get_resource_collection(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -563,13 +564,13 @@ async def get_resource_collection(self, **kwargs: Any) -> Any: get_resource_collection.metadata = {"url": "/model-flatten/resourcecollection"} # type: ignore @distributed_trace_async - async def put_simple_product(self, simple_body_product: Any = None, **kwargs: Any) -> Any: + async def put_simple_product(self, simple_body_product: JSONType = None, **kwargs: Any) -> JSONType: """Put Simple Product with client flattening true on the model. :param simple_body_product: Simple body product to put. - :type simple_body_product: Any + :type simple_body_product: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -603,7 +604,7 @@ async def put_simple_product(self, simple_body_product: Any = None, **kwargs: An } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -641,13 +642,13 @@ async def put_simple_product(self, simple_body_product: Any = None, **kwargs: An put_simple_product.metadata = {"url": "/model-flatten/customFlattening"} # type: ignore @distributed_trace_async - async def post_flattened_simple_product(self, simple_body_product: Any = None, **kwargs: Any) -> Any: + async def post_flattened_simple_product(self, simple_body_product: JSONType = None, **kwargs: Any) -> JSONType: """Put Flattened Simple Product with client flattening true on the parameter. :param simple_body_product: Simple body product to post. - :type simple_body_product: Any + :type simple_body_product: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -681,7 +682,7 @@ async def post_flattened_simple_product(self, simple_body_product: Any = None, * } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -719,15 +720,17 @@ async def post_flattened_simple_product(self, simple_body_product: Any = None, * post_flattened_simple_product.metadata = {"url": "/model-flatten/customFlattening"} # type: ignore @distributed_trace_async - async def put_simple_product_with_grouping(self, name: str, simple_body_product: Any = None, **kwargs: Any) -> Any: + async def put_simple_product_with_grouping( + self, name: str, simple_body_product: JSONType = None, **kwargs: Any + ) -> JSONType: """Put Simple Product with client flattening true on the model. :param name: Product name with value 'groupproduct'. :type name: str :param simple_body_product: Simple body product to put. - :type simple_body_product: Any + :type simple_body_product: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -761,7 +764,7 @@ async def put_simple_product_with_grouping(self, name: str, simple_body_product: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/operations/_operations.py index c36748d74d9..81ffa949ac5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/operations/_operations.py @@ -29,6 +29,7 @@ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -292,14 +293,14 @@ class AutoRestResourceFlatteningTestServiceOperationsMixin(object): @distributed_trace def put_array( self, - resource_array=None, # type: Optional[List[Any]] + resource_array=None, # type: Optional[List[JSONType]] **kwargs # type: Any ): # type: (...) -> None """Put External Resource as an Array. :param resource_array: External Resource as an Array to put. - :type resource_array: list[Any] + :type resource_array: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -354,11 +355,11 @@ def put_array( def get_array( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Get External Resource as an Array. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -383,7 +384,7 @@ def get_array( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -414,7 +415,7 @@ def get_array( @distributed_trace def put_wrapped_array( self, - resource_array=None, # type: Optional[List[Any]] + resource_array=None, # type: Optional[List[JSONType]] **kwargs # type: Any ): # type: (...) -> None @@ -422,7 +423,7 @@ def put_wrapped_array( is not removed if it's referenced in an array. :param resource_array: External Resource as an Array to put. - :type resource_array: list[Any] + :type resource_array: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -471,12 +472,12 @@ def put_wrapped_array( def get_wrapped_array( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -491,7 +492,7 @@ def get_wrapped_array( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -522,14 +523,14 @@ def get_wrapped_array( @distributed_trace def put_dictionary( self, - resource_dictionary=None, # type: Optional[Dict[str, Any]] + resource_dictionary=None, # type: Optional[Dict[str, JSONType]] **kwargs # type: Any ): # type: (...) -> None """Put External Resource as a Dictionary. :param resource_dictionary: External Resource as a Dictionary to put. - :type resource_dictionary: dict[str, Any] + :type resource_dictionary: dict[str, JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -590,11 +591,11 @@ def put_dictionary( def get_dictionary( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, Any] + # type: (...) -> Dict[str, JSONType] """Get External Resource as a Dictionary. :return: dict mapping str to JSON object - :rtype: dict[str, Any] + :rtype: dict[str, JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -619,7 +620,7 @@ def get_dictionary( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -650,14 +651,14 @@ def get_dictionary( @distributed_trace def put_resource_collection( self, - resource_complex_object=None, # type: Any + resource_complex_object=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put External Resource as a ResourceCollection. :param resource_complex_object: External Resource as a ResourceCollection to put. - :type resource_complex_object: Any + :type resource_complex_object: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -752,11 +753,11 @@ def put_resource_collection( def get_resource_collection( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get External Resource as a ResourceCollection. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -815,7 +816,7 @@ def get_resource_collection( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -846,16 +847,16 @@ def get_resource_collection( @distributed_trace def put_simple_product( self, - simple_body_product=None, # type: Any + simple_body_product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Put Simple Product with client flattening true on the model. :param simple_body_product: Simple body product to put. - :type simple_body_product: Any + :type simple_body_product: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -889,7 +890,7 @@ def put_simple_product( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -929,16 +930,16 @@ def put_simple_product( @distributed_trace def post_flattened_simple_product( self, - simple_body_product=None, # type: Any + simple_body_product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Put Flattened Simple Product with client flattening true on the parameter. :param simple_body_product: Simple body product to post. - :type simple_body_product: Any + :type simple_body_product: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -972,7 +973,7 @@ def post_flattened_simple_product( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1013,18 +1014,18 @@ def post_flattened_simple_product( def put_simple_product_with_grouping( self, name, # type: str - simple_body_product=None, # type: Any + simple_body_product=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Put Simple Product with client flattening true on the model. :param name: Product name with value 'groupproduct'. :type name: str :param simple_body_product: Simple body product to put. - :type simple_body_product: Any + :type simple_body_product: JSONType :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1058,7 +1059,7 @@ def put_simple_product_with_grouping( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/operations/_operations.py index cc40df34fa4..e6b1bbbb21f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/operations/_operations.py @@ -35,16 +35,17 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MultipleInheritanceServiceClientOperationsMixin: @distributed_trace_async - async def get_horse(self, **kwargs: Any) -> Any: + async def get_horse(self, **kwargs: Any) -> JSONType: """Get a horse with name 'Fred' and isAShowHorse true. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -56,7 +57,7 @@ async def get_horse(self, **kwargs: Any) -> Any: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -85,11 +86,11 @@ async def get_horse(self, **kwargs: Any) -> Any: get_horse.metadata = {"url": "/multipleInheritance/horse"} # type: ignore @distributed_trace_async - async def put_horse(self, horse: Any, **kwargs: Any) -> str: + async def put_horse(self, horse: JSONType, **kwargs: Any) -> str: """Put a horse with name 'General' and isAShowHorse false. :param horse: Put a horse with name 'General' and isAShowHorse false. - :type horse: Any + :type horse: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError @@ -138,11 +139,11 @@ async def put_horse(self, horse: Any, **kwargs: Any) -> str: put_horse.metadata = {"url": "/multipleInheritance/horse"} # type: ignore @distributed_trace_async - async def get_pet(self, **kwargs: Any) -> Any: + async def get_pet(self, **kwargs: Any) -> JSONType: """Get a pet with name 'Peanut'. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -153,7 +154,7 @@ async def get_pet(self, **kwargs: Any) -> Any: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -182,11 +183,11 @@ async def get_pet(self, **kwargs: Any) -> Any: get_pet.metadata = {"url": "/multipleInheritance/pet"} # type: ignore @distributed_trace_async - async def put_pet(self, pet: Any, **kwargs: Any) -> str: + async def put_pet(self, pet: JSONType, **kwargs: Any) -> str: """Put a pet with name 'Butter'. :param pet: Put a pet with name 'Butter'. - :type pet: Any + :type pet: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError @@ -234,11 +235,11 @@ async def put_pet(self, pet: Any, **kwargs: Any) -> str: put_pet.metadata = {"url": "/multipleInheritance/pet"} # type: ignore @distributed_trace_async - async def get_feline(self, **kwargs: Any) -> Any: + async def get_feline(self, **kwargs: Any) -> JSONType: """Get a feline where meows and hisses are true. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -250,7 +251,7 @@ async def get_feline(self, **kwargs: Any) -> Any: "meows": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -279,11 +280,11 @@ async def get_feline(self, **kwargs: Any) -> Any: get_feline.metadata = {"url": "/multipleInheritance/feline"} # type: ignore @distributed_trace_async - async def put_feline(self, feline: Any, **kwargs: Any) -> str: + async def put_feline(self, feline: JSONType, **kwargs: Any) -> str: """Put a feline who hisses and doesn't meow. :param feline: Put a feline who hisses and doesn't meow. - :type feline: Any + :type feline: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError @@ -332,11 +333,11 @@ async def put_feline(self, feline: Any, **kwargs: Any) -> str: put_feline.metadata = {"url": "/multipleInheritance/feline"} # type: ignore @distributed_trace_async - async def get_cat(self, **kwargs: Any) -> Any: + async def get_cat(self, **kwargs: Any) -> JSONType: """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -350,7 +351,7 @@ async def get_cat(self, **kwargs: Any) -> Any: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -379,11 +380,11 @@ async def get_cat(self, **kwargs: Any) -> Any: get_cat.metadata = {"url": "/multipleInheritance/cat"} # type: ignore @distributed_trace_async - async def put_cat(self, cat: Any, **kwargs: Any) -> str: + async def put_cat(self, cat: JSONType, **kwargs: Any) -> str: """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. :param cat: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. - :type cat: Any + :type cat: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError @@ -434,12 +435,12 @@ async def put_cat(self, cat: Any, **kwargs: Any) -> str: put_cat.metadata = {"url": "/multipleInheritance/cat"} # type: ignore @distributed_trace_async - async def get_kitten(self, **kwargs: Any) -> Any: + async def get_kitten(self, **kwargs: Any) -> JSONType: """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet is false. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -454,7 +455,7 @@ async def get_kitten(self, **kwargs: Any) -> Any: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -483,13 +484,13 @@ async def get_kitten(self, **kwargs: Any) -> Any: get_kitten.metadata = {"url": "/multipleInheritance/kitten"} # type: ignore @distributed_trace_async - async def put_kitten(self, kitten: Any, **kwargs: Any) -> str: + async def put_kitten(self, kitten: JSONType, **kwargs: Any) -> str: """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. :param kitten: Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. - :type kitten: Any + :type kitten: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/operations/_operations.py index ad3112e28a8..f241dc6f495 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -257,11 +258,11 @@ class MultipleInheritanceServiceClientOperationsMixin(object): def get_horse( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a horse with name 'Fred' and isAShowHorse true. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -273,7 +274,7 @@ def get_horse( "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -304,14 +305,14 @@ def get_horse( @distributed_trace def put_horse( self, - horse, # type: Any + horse, # type: JSONType **kwargs # type: Any ): # type: (...) -> str """Put a horse with name 'General' and isAShowHorse false. :param horse: Put a horse with name 'General' and isAShowHorse false. - :type horse: Any + :type horse: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError @@ -363,11 +364,11 @@ def put_horse( def get_pet( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a pet with name 'Peanut'. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -378,7 +379,7 @@ def get_pet( "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -409,14 +410,14 @@ def get_pet( @distributed_trace def put_pet( self, - pet, # type: Any + pet, # type: JSONType **kwargs # type: Any ): # type: (...) -> str """Put a pet with name 'Butter'. :param pet: Put a pet with name 'Butter'. - :type pet: Any + :type pet: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError @@ -467,11 +468,11 @@ def put_pet( def get_feline( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a feline where meows and hisses are true. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -483,7 +484,7 @@ def get_feline( "meows": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -514,14 +515,14 @@ def get_feline( @distributed_trace def put_feline( self, - feline, # type: Any + feline, # type: JSONType **kwargs # type: Any ): # type: (...) -> str """Put a feline who hisses and doesn't meow. :param feline: Put a feline who hisses and doesn't meow. - :type feline: Any + :type feline: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError @@ -573,11 +574,11 @@ def put_feline( def get_cat( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -591,7 +592,7 @@ def get_cat( "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -622,14 +623,14 @@ def get_cat( @distributed_trace def put_cat( self, - cat, # type: Any + cat, # type: JSONType **kwargs # type: Any ): # type: (...) -> str """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. :param cat: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. - :type cat: Any + :type cat: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError @@ -683,12 +684,12 @@ def put_cat( def get_kitten( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet is false. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -703,7 +704,7 @@ def get_kitten( "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -734,7 +735,7 @@ def get_kitten( @distributed_trace def put_kitten( self, - kitten, # type: Any + kitten, # type: JSONType **kwargs # type: Any ): # type: (...) -> str @@ -743,7 +744,7 @@ def put_kitten( :param kitten: Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. - :type kitten: Any + :type kitten: JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py index 3918e270c75..98b44e50d67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py @@ -29,6 +29,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py index 6713a15ae34..ad5456878ae 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/operations/_operations.py index 4d0d0a625ff..f1fe00b70e8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import build_get_request, build_put_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/operations/_operations.py index a7591fdadf5..bb2ecd16093 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py index 5e6944f97f7..e2c48d0fee1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import build_availability_sets_update_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def update(self, resource_group_name: str, avset: str, tags: Any, **kwargs: Any) -> None: + async def update(self, resource_group_name: str, avset: str, tags: JSONType, **kwargs: Any) -> None: """Updates the tags for an availability set. :param resource_group_name: The name of the resource group. @@ -54,7 +55,7 @@ async def update(self, resource_group_name: str, avset: str, tags: Any, **kwargs :param avset: The name of the storage availability set. :type avset: str :param tags: The tags. - :type tags: Any + :type tags: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py index 27ee1794e9c..2094e2260c5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py @@ -29,6 +29,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -87,7 +88,7 @@ def update( self, resource_group_name, # type: str avset, # type: str - tags, # type: Any + tags, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -98,7 +99,7 @@ def update( :param avset: The name of the storage availability set. :type avset: str :param tags: The tags. - :type tags: Any + :type tags: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/operations/_operations.py index bcf6c43e18f..c7a90f2b0f0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import build_get_optional_report_request, build_get_report_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/operations/_operations.py index 2db7accfba8..9130961ba82 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py index 920318a689a..866ae0ecb40 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py @@ -57,6 +57,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -513,12 +514,12 @@ async def post_optional_integer_parameter(self, body_parameter: Optional[int] = post_optional_integer_parameter.metadata = {"url": "/reqopt/optional/integer/parameter"} # type: ignore @distributed_trace_async - async def post_required_integer_property(self, body_parameter: Any, **kwargs: Any) -> None: + async def post_required_integer_property(self, body_parameter: JSONType, **kwargs: Any) -> None: """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -559,11 +560,11 @@ async def post_required_integer_property(self, body_parameter: Any, **kwargs: An post_required_integer_property.metadata = {"url": "/reqopt/requied/integer/property"} # type: ignore @distributed_trace_async - async def post_optional_integer_property(self, body_parameter: Any = None, **kwargs: Any) -> None: + async def post_optional_integer_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -750,12 +751,12 @@ async def post_optional_string_parameter(self, body_parameter: Optional[str] = N post_optional_string_parameter.metadata = {"url": "/reqopt/optional/string/parameter"} # type: ignore @distributed_trace_async - async def post_required_string_property(self, body_parameter: Any, **kwargs: Any) -> None: + async def post_required_string_property(self, body_parameter: JSONType, **kwargs: Any) -> None: """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -796,11 +797,11 @@ async def post_required_string_property(self, body_parameter: Any, **kwargs: Any post_required_string_property.metadata = {"url": "/reqopt/requied/string/property"} # type: ignore @distributed_trace_async - async def post_optional_string_property(self, body_parameter: Any = None, **kwargs: Any) -> None: + async def post_optional_string_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -909,12 +910,12 @@ async def post_optional_string_header(self, *, body_parameter: Optional[str] = N post_optional_string_header.metadata = {"url": "/reqopt/optional/string/header"} # type: ignore @distributed_trace_async - async def post_required_class_parameter(self, body_parameter: Any, **kwargs: Any) -> None: + async def post_required_class_parameter(self, body_parameter: JSONType, **kwargs: Any) -> None: """Test explicitly required complex object. Please put null and the client library should throw before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -956,11 +957,11 @@ async def post_required_class_parameter(self, body_parameter: Any, **kwargs: Any post_required_class_parameter.metadata = {"url": "/reqopt/requied/class/parameter"} # type: ignore @distributed_trace_async - async def post_optional_class_parameter(self, body_parameter: Any = None, **kwargs: Any) -> None: + async def post_optional_class_parameter(self, body_parameter: JSONType = None, **kwargs: Any) -> None: """Test explicitly optional complex object. Please put null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1005,12 +1006,12 @@ async def post_optional_class_parameter(self, body_parameter: Any = None, **kwar post_optional_class_parameter.metadata = {"url": "/reqopt/optional/class/parameter"} # type: ignore @distributed_trace_async - async def post_required_class_property(self, body_parameter: Any, **kwargs: Any) -> None: + async def post_required_class_property(self, body_parameter: JSONType, **kwargs: Any) -> None: """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1054,11 +1055,11 @@ async def post_required_class_property(self, body_parameter: Any, **kwargs: Any) post_required_class_property.metadata = {"url": "/reqopt/requied/class/property"} # type: ignore @distributed_trace_async - async def post_optional_class_property(self, body_parameter: Any = None, **kwargs: Any) -> None: + async def post_optional_class_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1199,12 +1200,12 @@ async def post_optional_array_parameter(self, body_parameter: Optional[List[str] post_optional_array_parameter.metadata = {"url": "/reqopt/optional/array/parameter"} # type: ignore @distributed_trace_async - async def post_required_array_property(self, body_parameter: Any, **kwargs: Any) -> None: + async def post_required_array_property(self, body_parameter: JSONType, **kwargs: Any) -> None: """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1247,11 +1248,11 @@ async def post_required_array_property(self, body_parameter: Any, **kwargs: Any) post_required_array_property.metadata = {"url": "/reqopt/requied/array/property"} # type: ignore @distributed_trace_async - async def post_optional_array_property(self, body_parameter: Any = None, **kwargs: Any) -> None: + async def post_optional_array_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py index 9da8c8c53a6..d3a0e233951 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py @@ -29,6 +29,7 @@ from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -1323,7 +1324,7 @@ def post_optional_integer_parameter( @distributed_trace def post_required_integer_property( self, - body_parameter, # type: Any + body_parameter, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -1331,7 +1332,7 @@ def post_required_integer_property( client library should throw before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1374,14 +1375,14 @@ def post_required_integer_property( @distributed_trace def post_optional_integer_property( self, - body_parameter=None, # type: Any + body_parameter=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1590,7 +1591,7 @@ def post_optional_string_parameter( @distributed_trace def post_required_string_property( self, - body_parameter, # type: Any + body_parameter, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -1598,7 +1599,7 @@ def post_required_string_property( client library should throw before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1641,14 +1642,14 @@ def post_required_string_property( @distributed_trace def post_optional_string_property( self, - body_parameter=None, # type: Any + body_parameter=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1769,7 +1770,7 @@ def post_optional_string_header( @distributed_trace def post_required_class_parameter( self, - body_parameter, # type: Any + body_parameter, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -1777,7 +1778,7 @@ def post_required_class_parameter( before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1821,14 +1822,14 @@ def post_required_class_parameter( @distributed_trace def post_optional_class_parameter( self, - body_parameter=None, # type: Any + body_parameter=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Test explicitly optional complex object. Please put null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1875,7 +1876,7 @@ def post_optional_class_parameter( @distributed_trace def post_required_class_property( self, - body_parameter, # type: Any + body_parameter, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -1883,7 +1884,7 @@ def post_required_class_property( and the client library should throw before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1929,14 +1930,14 @@ def post_required_class_property( @distributed_trace def post_optional_class_property( self, - body_parameter=None, # type: Any + body_parameter=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2089,7 +2090,7 @@ def post_optional_array_parameter( @distributed_trace def post_required_array_property( self, - body_parameter, # type: Any + body_parameter, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -2097,7 +2098,7 @@ def post_required_array_property( client library should throw before the request is sent. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2142,14 +2143,14 @@ def post_required_array_property( @distributed_trace def post_optional_array_property( self, - body_parameter=None, # type: Any + body_parameter=None, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. :param body_parameter: - :type body_parameter: Any + :type body_parameter: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py index 6c018bbfad6..f132f48934b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py @@ -24,6 +24,7 @@ from ...operations._operations import build_import_builders_operation_one_request T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py index 0ddc1d7e3aa..fde25177c3e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py @@ -27,6 +27,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/operations/_operations.py index 6e9de966012..53b4f435207 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/operations/_operations.py @@ -29,12 +29,13 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AutoRestValidationTestOperationsMixin: @distributed_trace_async - async def validation_of_method_parameters(self, resource_group_name: str, id: int, **kwargs: Any) -> Any: + async def validation_of_method_parameters(self, resource_group_name: str, id: int, **kwargs: Any) -> JSONType: """Validates input parameters on the method. See swagger for details. :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. @@ -45,7 +46,7 @@ async def validation_of_method_parameters(self, resource_group_name: str, id: in default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -71,7 +72,7 @@ async def validation_of_method_parameters(self, resource_group_name: str, id: in "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -106,7 +107,9 @@ async def validation_of_method_parameters(self, resource_group_name: str, id: in validation_of_method_parameters.metadata = {"url": "/fakepath/{subscriptionId}/{resourceGroupName}/{id}"} # type: ignore @distributed_trace_async - async def validation_of_body(self, resource_group_name: str, id: int, body: Any = None, **kwargs: Any) -> Any: + async def validation_of_body( + self, resource_group_name: str, id: int, body: JSONType = None, **kwargs: Any + ) -> JSONType: """Validates body parameters on the method. See swagger for details. :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. @@ -114,12 +117,12 @@ async def validation_of_body(self, resource_group_name: str, id: int, body: Any :param id: Required int multiple of 10 from 100 to 1000. :type id: int :param body: - :type body: Any + :type body: JSONType :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -165,7 +168,7 @@ async def validation_of_body(self, resource_group_name: str, id: int, body: Any "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -243,16 +246,16 @@ async def get_with_constant_in_path(self, **kwargs: Any) -> None: get_with_constant_in_path.metadata = {"url": "/validation/constantsInPath/{constantParam}/value"} # type: ignore @distributed_trace_async - async def post_with_constant_in_body(self, body: Any = None, **kwargs: Any) -> Any: + async def post_with_constant_in_body(self, body: JSONType = None, **kwargs: Any) -> JSONType: """post_with_constant_in_body. :param body: - :type body: Any + :type body: JSONType :keyword constant_param: The default value is "constant". Note that overriding this default value may result in unsupported behavior. :paramtype constant_param: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -298,7 +301,7 @@ async def post_with_constant_in_body(self, body: Any = None, **kwargs: Any) -> A "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/operations/_operations.py index 228cac6a12a..63ebd512c50 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/operations/_operations.py @@ -29,6 +29,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -170,7 +171,7 @@ def validation_of_method_parameters( id, # type: int **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Validates input parameters on the method. See swagger for details. :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. @@ -181,7 +182,7 @@ def validation_of_method_parameters( default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -207,7 +208,7 @@ def validation_of_method_parameters( "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -246,10 +247,10 @@ def validation_of_body( self, resource_group_name, # type: str id, # type: int - body=None, # type: Any + body=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Validates body parameters on the method. See swagger for details. :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. @@ -257,12 +258,12 @@ def validation_of_body( :param id: Required int multiple of 10 from 100 to 1000. :type id: int :param body: - :type body: Any + :type body: JSONType :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -308,7 +309,7 @@ def validation_of_body( "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -391,19 +392,19 @@ def get_with_constant_in_path( @distributed_trace def post_with_constant_in_body( self, - body=None, # type: Any + body=None, # type: JSONType **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """post_with_constant_in_body. :param body: - :type body: Any + :type body: JSONType :keyword constant_param: The default value is "constant". Note that overriding this default value may result in unsupported behavior. :paramtype constant_param: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -449,7 +450,7 @@ def post_with_constant_in_body( "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py index 1b474a44c34..2381a054b09 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py @@ -60,6 +60,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,11 +83,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> Any: + async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> JSONType: """Get a complex type that has a ref to a complex type with no XML node. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -100,7 +101,7 @@ async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> Any: "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -129,11 +130,11 @@ async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> Any: get_complex_type_ref_no_meta.metadata = {"url": "/xml/complex-type-ref-no-meta"} # type: ignore @distributed_trace_async - async def put_complex_type_ref_no_meta(self, model: Any, **kwargs: Any) -> None: + async def put_complex_type_ref_no_meta(self, model: JSONType, **kwargs: Any) -> None: """Puts a complex type that has a ref to a complex type with no XML node. :param model: - :type model: Any + :type model: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -177,11 +178,11 @@ async def put_complex_type_ref_no_meta(self, model: Any, **kwargs: Any) -> None: put_complex_type_ref_no_meta.metadata = {"url": "/xml/complex-type-ref-no-meta"} # type: ignore @distributed_trace_async - async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> Any: + async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> JSONType: """Get a complex type that has a ref to a complex type with XML node. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -195,7 +196,7 @@ async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> Any: "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -224,11 +225,11 @@ async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> Any: get_complex_type_ref_with_meta.metadata = {"url": "/xml/complex-type-ref-with-meta"} # type: ignore @distributed_trace_async - async def put_complex_type_ref_with_meta(self, model: Any, **kwargs: Any) -> None: + async def put_complex_type_ref_with_meta(self, model: JSONType, **kwargs: Any) -> None: """Puts a complex type that has a ref to a complex type with XML node. :param model: - :type model: Any + :type model: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -272,11 +273,11 @@ async def put_complex_type_ref_with_meta(self, model: Any, **kwargs: Any) -> Non put_complex_type_ref_with_meta.metadata = {"url": "/xml/complex-type-ref-with-meta"} # type: ignore @distributed_trace_async - async def get_simple(self, **kwargs: Any) -> Any: + async def get_simple(self, **kwargs: Any) -> JSONType: """Get a simple XML document. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -298,7 +299,7 @@ async def get_simple(self, **kwargs: Any) -> Any: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -327,11 +328,11 @@ async def get_simple(self, **kwargs: Any) -> Any: get_simple.metadata = {"url": "/xml/simple"} # type: ignore @distributed_trace_async - async def put_simple(self, slideshow: Any, **kwargs: Any) -> None: + async def put_simple(self, slideshow: JSONType, **kwargs: Any) -> None: """Put a simple XML document. :param slideshow: - :type slideshow: Any + :type slideshow: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -383,11 +384,11 @@ async def put_simple(self, slideshow: Any, **kwargs: Any) -> None: put_simple.metadata = {"url": "/xml/simple"} # type: ignore @distributed_trace_async - async def get_wrapped_lists(self, **kwargs: Any) -> Any: + async def get_wrapped_lists(self, **kwargs: Any) -> JSONType: """Get an XML document with multiple wrapped lists. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -403,7 +404,7 @@ async def get_wrapped_lists(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -432,11 +433,11 @@ async def get_wrapped_lists(self, **kwargs: Any) -> Any: get_wrapped_lists.metadata = {"url": "/xml/wrapped-lists"} # type: ignore @distributed_trace_async - async def put_wrapped_lists(self, wrapped_lists: Any, **kwargs: Any) -> None: + async def put_wrapped_lists(self, wrapped_lists: JSONType, **kwargs: Any) -> None: """Put an XML document with multiple wrapped lists. :param wrapped_lists: - :type wrapped_lists: Any + :type wrapped_lists: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -514,11 +515,11 @@ async def get_headers(self, **kwargs: Any) -> None: get_headers.metadata = {"url": "/xml/headers"} # type: ignore @distributed_trace_async - async def get_empty_list(self, **kwargs: Any) -> Any: + async def get_empty_list(self, **kwargs: Any) -> JSONType: """Get an empty list. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -540,7 +541,7 @@ async def get_empty_list(self, **kwargs: Any) -> Any: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -569,11 +570,11 @@ async def get_empty_list(self, **kwargs: Any) -> Any: get_empty_list.metadata = {"url": "/xml/empty-list"} # type: ignore @distributed_trace_async - async def put_empty_list(self, slideshow: Any, **kwargs: Any) -> None: + async def put_empty_list(self, slideshow: JSONType, **kwargs: Any) -> None: """Puts an empty list. :param slideshow: - :type slideshow: Any + :type slideshow: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -625,11 +626,11 @@ async def put_empty_list(self, slideshow: Any, **kwargs: Any) -> None: put_empty_list.metadata = {"url": "/xml/empty-list"} # type: ignore @distributed_trace_async - async def get_empty_wrapped_lists(self, **kwargs: Any) -> Any: + async def get_empty_wrapped_lists(self, **kwargs: Any) -> JSONType: """Gets some empty wrapped lists. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -645,7 +646,7 @@ async def get_empty_wrapped_lists(self, **kwargs: Any) -> Any: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -674,11 +675,11 @@ async def get_empty_wrapped_lists(self, **kwargs: Any) -> Any: get_empty_wrapped_lists.metadata = {"url": "/xml/empty-wrapped-lists"} # type: ignore @distributed_trace_async - async def put_empty_wrapped_lists(self, apple_barrel: Any, **kwargs: Any) -> None: + async def put_empty_wrapped_lists(self, apple_barrel: JSONType, **kwargs: Any) -> None: """Puts some empty wrapped lists. :param apple_barrel: - :type apple_barrel: Any + :type apple_barrel: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -724,11 +725,11 @@ async def put_empty_wrapped_lists(self, apple_barrel: Any, **kwargs: Any) -> Non put_empty_wrapped_lists.metadata = {"url": "/xml/empty-wrapped-lists"} # type: ignore @distributed_trace_async - async def get_root_list(self, **kwargs: Any) -> List[Any]: + async def get_root_list(self, **kwargs: Any) -> List[JSONType]: """Gets a list as the root element. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -743,7 +744,7 @@ async def get_root_list(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -772,11 +773,11 @@ async def get_root_list(self, **kwargs: Any) -> List[Any]: get_root_list.metadata = {"url": "/xml/root-list"} # type: ignore @distributed_trace_async - async def put_root_list(self, bananas: List[Any], **kwargs: Any) -> None: + async def put_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: """Puts a list as the root element. :param bananas: - :type bananas: list[Any] + :type bananas: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -822,11 +823,11 @@ async def put_root_list(self, bananas: List[Any], **kwargs: Any) -> None: put_root_list.metadata = {"url": "/xml/root-list"} # type: ignore @distributed_trace_async - async def get_root_list_single_item(self, **kwargs: Any) -> List[Any]: + async def get_root_list_single_item(self, **kwargs: Any) -> List[JSONType]: """Gets a list with a single item. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -841,7 +842,7 @@ async def get_root_list_single_item(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -870,11 +871,11 @@ async def get_root_list_single_item(self, **kwargs: Any) -> List[Any]: get_root_list_single_item.metadata = {"url": "/xml/root-list-single-item"} # type: ignore @distributed_trace_async - async def put_root_list_single_item(self, bananas: List[Any], **kwargs: Any) -> None: + async def put_root_list_single_item(self, bananas: List[JSONType], **kwargs: Any) -> None: """Puts a list with a single item. :param bananas: - :type bananas: list[Any] + :type bananas: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -920,11 +921,11 @@ async def put_root_list_single_item(self, bananas: List[Any], **kwargs: Any) -> put_root_list_single_item.metadata = {"url": "/xml/root-list-single-item"} # type: ignore @distributed_trace_async - async def get_empty_root_list(self, **kwargs: Any) -> List[Any]: + async def get_empty_root_list(self, **kwargs: Any) -> List[JSONType]: """Gets an empty list as the root element. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -939,7 +940,7 @@ async def get_empty_root_list(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -968,11 +969,11 @@ async def get_empty_root_list(self, **kwargs: Any) -> List[Any]: get_empty_root_list.metadata = {"url": "/xml/empty-root-list"} # type: ignore @distributed_trace_async - async def put_empty_root_list(self, bananas: List[Any], **kwargs: Any) -> None: + async def put_empty_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: """Puts an empty list as the root element. :param bananas: - :type bananas: list[Any] + :type bananas: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1018,11 +1019,11 @@ async def put_empty_root_list(self, bananas: List[Any], **kwargs: Any) -> None: put_empty_root_list.metadata = {"url": "/xml/empty-root-list"} # type: ignore @distributed_trace_async - async def get_empty_child_element(self, **kwargs: Any) -> Any: + async def get_empty_child_element(self, **kwargs: Any) -> JSONType: """Gets an XML document with an empty child element. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1035,7 +1036,7 @@ async def get_empty_child_element(self, **kwargs: Any) -> Any: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1064,11 +1065,11 @@ async def get_empty_child_element(self, **kwargs: Any) -> Any: get_empty_child_element.metadata = {"url": "/xml/empty-child-element"} # type: ignore @distributed_trace_async - async def put_empty_child_element(self, banana: Any, **kwargs: Any) -> None: + async def put_empty_child_element(self, banana: JSONType, **kwargs: Any) -> None: """Puts a value with an empty child element. :param banana: - :type banana: Any + :type banana: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1111,14 +1112,14 @@ async def put_empty_child_element(self, banana: Any, **kwargs: Any) -> None: put_empty_child_element.metadata = {"url": "/xml/empty-child-element"} # type: ignore @distributed_trace_async - async def list_containers(self, **kwargs: Any) -> Any: + async def list_containers(self, **kwargs: Any) -> JSONType: """Lists containers in a storage account. :keyword comp: The default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1149,7 +1150,7 @@ async def list_containers(self, **kwargs: Any) -> Any: "ServiceEndpoint": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1181,7 +1182,7 @@ async def list_containers(self, **kwargs: Any) -> Any: list_containers.metadata = {"url": "/xml/"} # type: ignore @distributed_trace_async - async def get_service_properties(self, **kwargs: Any) -> Any: + async def get_service_properties(self, **kwargs: Any) -> JSONType: """Gets storage service properties. :keyword comp: The default value is "properties". Note that overriding this default value may @@ -1191,7 +1192,7 @@ async def get_service_properties(self, **kwargs: Any) -> Any: result in unsupported behavior. :paramtype restype: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1243,7 +1244,7 @@ async def get_service_properties(self, **kwargs: Any) -> Any: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1277,11 +1278,11 @@ async def get_service_properties(self, **kwargs: Any) -> Any: get_service_properties.metadata = {"url": "/xml/"} # type: ignore @distributed_trace_async - async def put_service_properties(self, properties: Any, **kwargs: Any) -> None: + async def put_service_properties(self, properties: JSONType, **kwargs: Any) -> None: """Puts storage service properties. :param properties: - :type properties: Any + :type properties: JSONType :keyword comp: The default value is "properties". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str @@ -1373,7 +1374,7 @@ async def put_service_properties(self, properties: Any, **kwargs: Any) -> None: put_service_properties.metadata = {"url": "/xml/"} # type: ignore @distributed_trace_async - async def get_acls(self, **kwargs: Any) -> List[Any]: + async def get_acls(self, **kwargs: Any) -> List[JSONType]: """Gets storage ACLs for a container. :keyword comp: The default value is "acl". Note that overriding this default value may result @@ -1383,7 +1384,7 @@ async def get_acls(self, **kwargs: Any) -> List[Any]: result in unsupported behavior. :paramtype restype: str :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1401,7 +1402,7 @@ async def get_acls(self, **kwargs: Any) -> List[Any]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1435,11 +1436,11 @@ async def get_acls(self, **kwargs: Any) -> List[Any]: get_acls.metadata = {"url": "/xml/mycontainer"} # type: ignore @distributed_trace_async - async def put_acls(self, properties: List[Any], **kwargs: Any) -> None: + async def put_acls(self, properties: List[JSONType], **kwargs: Any) -> None: """Puts storage ACLs for a container. :param properties: - :type properties: list[Any] + :type properties: list[JSONType] :keyword comp: The default value is "acl". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str @@ -1498,7 +1499,7 @@ async def put_acls(self, properties: List[Any], **kwargs: Any) -> None: put_acls.metadata = {"url": "/xml/mycontainer"} # type: ignore @distributed_trace_async - async def list_blobs(self, **kwargs: Any) -> Any: + async def list_blobs(self, **kwargs: Any) -> JSONType: """Lists blobs in a storage container. :keyword comp: The default value is "list". Note that overriding this default value may result @@ -1508,7 +1509,7 @@ async def list_blobs(self, **kwargs: Any) -> Any: result in unsupported behavior. :paramtype restype: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1572,7 +1573,7 @@ async def list_blobs(self, **kwargs: Any) -> Any: "ServiceEndpoint": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1606,12 +1607,12 @@ async def list_blobs(self, **kwargs: Any) -> Any: list_blobs.metadata = {"url": "/xml/mycontainer"} # type: ignore @distributed_trace_async - async def json_input(self, properties: Any, **kwargs: Any) -> None: + async def json_input(self, properties: JSONType, **kwargs: Any) -> None: """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID number 42. :param properties: - :type properties: Any + :type properties: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1652,11 +1653,11 @@ async def json_input(self, properties: Any, **kwargs: Any) -> None: json_input.metadata = {"url": "/xml/jsoninput"} # type: ignore @distributed_trace_async - async def json_output(self, **kwargs: Any) -> Any: + async def json_output(self, **kwargs: Any) -> JSONType: """A Swagger with XML that has one operation that returns JSON. ID number 42. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1667,7 +1668,7 @@ async def json_output(self, **kwargs: Any) -> Any: "id": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1696,12 +1697,12 @@ async def json_output(self, **kwargs: Any) -> Any: json_output.metadata = {"url": "/xml/jsonoutput"} # type: ignore @distributed_trace_async - async def get_xms_text(self, **kwargs: Any) -> Any: + async def get_xms_text(self, **kwargs: Any) -> JSONType: """Get back an XML object with an x-ms-text property, which should translate to the returned object's 'language' property being 'english' and its 'content' property being 'I am text'. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1713,7 +1714,7 @@ async def get_xms_text(self, **kwargs: Any) -> Any: "language": "str" # Optional. Returned value should be 'english'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1742,11 +1743,11 @@ async def get_xms_text(self, **kwargs: Any) -> Any: get_xms_text.metadata = {"url": "/xml/x-ms-text"} # type: ignore @distributed_trace_async - async def get_bytes(self, **kwargs: Any) -> Any: + async def get_bytes(self, **kwargs: Any) -> JSONType: """Get an XML document with binary property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1757,7 +1758,7 @@ async def get_bytes(self, **kwargs: Any) -> Any: "Bytes": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1786,11 +1787,11 @@ async def get_bytes(self, **kwargs: Any) -> Any: get_bytes.metadata = {"url": "/xml/bytes"} # type: ignore @distributed_trace_async - async def put_binary(self, slideshow: Any, **kwargs: Any) -> None: + async def put_binary(self, slideshow: JSONType, **kwargs: Any) -> None: """Put an XML document with binary property. :param slideshow: - :type slideshow: Any + :type slideshow: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1831,11 +1832,11 @@ async def put_binary(self, slideshow: Any, **kwargs: Any) -> None: put_binary.metadata = {"url": "/xml/bytes"} # type: ignore @distributed_trace_async - async def get_uri(self, **kwargs: Any) -> Any: + async def get_uri(self, **kwargs: Any) -> JSONType: """Get an XML document with uri property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1846,7 +1847,7 @@ async def get_uri(self, **kwargs: Any) -> Any: "Url": str # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1875,11 +1876,11 @@ async def get_uri(self, **kwargs: Any) -> Any: get_uri.metadata = {"url": "/xml/url"} # type: ignore @distributed_trace_async - async def put_uri(self, model: Any, **kwargs: Any) -> None: + async def put_uri(self, model: JSONType, **kwargs: Any) -> None: """Put an XML document with uri property. :param model: - :type model: Any + :type model: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py index 61e3ad1659b..0f78539a5c8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py @@ -28,6 +28,7 @@ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -817,11 +818,11 @@ def __init__(self, client, config, serializer, deserializer): def get_complex_type_ref_no_meta( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a complex type that has a ref to a complex type with no XML node. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -835,7 +836,7 @@ def get_complex_type_ref_no_meta( "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -866,14 +867,14 @@ def get_complex_type_ref_no_meta( @distributed_trace def put_complex_type_ref_no_meta( self, - model, # type: Any + model, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Puts a complex type that has a ref to a complex type with no XML node. :param model: - :type model: Any + :type model: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -920,11 +921,11 @@ def put_complex_type_ref_no_meta( def get_complex_type_ref_with_meta( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a complex type that has a ref to a complex type with XML node. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -938,7 +939,7 @@ def get_complex_type_ref_with_meta( "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -969,14 +970,14 @@ def get_complex_type_ref_with_meta( @distributed_trace def put_complex_type_ref_with_meta( self, - model, # type: Any + model, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Puts a complex type that has a ref to a complex type with XML node. :param model: - :type model: Any + :type model: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1023,11 +1024,11 @@ def put_complex_type_ref_with_meta( def get_simple( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get a simple XML document. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1049,7 +1050,7 @@ def get_simple( "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1080,14 +1081,14 @@ def get_simple( @distributed_trace def put_simple( self, - slideshow, # type: Any + slideshow, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put a simple XML document. :param slideshow: - :type slideshow: Any + :type slideshow: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1142,11 +1143,11 @@ def put_simple( def get_wrapped_lists( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get an XML document with multiple wrapped lists. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1162,7 +1163,7 @@ def get_wrapped_lists( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1193,14 +1194,14 @@ def get_wrapped_lists( @distributed_trace def put_wrapped_lists( self, - wrapped_lists, # type: Any + wrapped_lists, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put an XML document with multiple wrapped lists. :param wrapped_lists: - :type wrapped_lists: Any + :type wrapped_lists: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1284,11 +1285,11 @@ def get_headers( def get_empty_list( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get an empty list. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1310,7 +1311,7 @@ def get_empty_list( "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1341,14 +1342,14 @@ def get_empty_list( @distributed_trace def put_empty_list( self, - slideshow, # type: Any + slideshow, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Puts an empty list. :param slideshow: - :type slideshow: Any + :type slideshow: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1403,11 +1404,11 @@ def put_empty_list( def get_empty_wrapped_lists( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Gets some empty wrapped lists. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1423,7 +1424,7 @@ def get_empty_wrapped_lists( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1454,14 +1455,14 @@ def get_empty_wrapped_lists( @distributed_trace def put_empty_wrapped_lists( self, - apple_barrel, # type: Any + apple_barrel, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Puts some empty wrapped lists. :param apple_barrel: - :type apple_barrel: Any + :type apple_barrel: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1510,11 +1511,11 @@ def put_empty_wrapped_lists( def get_root_list( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Gets a list as the root element. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1529,7 +1530,7 @@ def get_root_list( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1560,14 +1561,14 @@ def get_root_list( @distributed_trace def put_root_list( self, - bananas, # type: List[Any] + bananas, # type: List[JSONType] **kwargs # type: Any ): # type: (...) -> None """Puts a list as the root element. :param bananas: - :type bananas: list[Any] + :type bananas: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1616,11 +1617,11 @@ def put_root_list( def get_root_list_single_item( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Gets a list with a single item. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1635,7 +1636,7 @@ def get_root_list_single_item( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1666,14 +1667,14 @@ def get_root_list_single_item( @distributed_trace def put_root_list_single_item( self, - bananas, # type: List[Any] + bananas, # type: List[JSONType] **kwargs # type: Any ): # type: (...) -> None """Puts a list with a single item. :param bananas: - :type bananas: list[Any] + :type bananas: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1722,11 +1723,11 @@ def put_root_list_single_item( def get_empty_root_list( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Gets an empty list as the root element. :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1741,7 +1742,7 @@ def get_empty_root_list( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1772,14 +1773,14 @@ def get_empty_root_list( @distributed_trace def put_empty_root_list( self, - bananas, # type: List[Any] + bananas, # type: List[JSONType] **kwargs # type: Any ): # type: (...) -> None """Puts an empty list as the root element. :param bananas: - :type bananas: list[Any] + :type bananas: list[JSONType] :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1828,11 +1829,11 @@ def put_empty_root_list( def get_empty_child_element( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Gets an XML document with an empty child element. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1845,7 +1846,7 @@ def get_empty_child_element( "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -1876,14 +1877,14 @@ def get_empty_child_element( @distributed_trace def put_empty_child_element( self, - banana, # type: Any + banana, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Puts a value with an empty child element. :param banana: - :type banana: Any + :type banana: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -1929,14 +1930,14 @@ def put_empty_child_element( def list_containers( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Lists containers in a storage account. :keyword comp: The default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -1967,7 +1968,7 @@ def list_containers( "ServiceEndpoint": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2002,7 +2003,7 @@ def list_containers( def get_service_properties( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Gets storage service properties. :keyword comp: The default value is "properties". Note that overriding this default value may @@ -2012,7 +2013,7 @@ def get_service_properties( result in unsupported behavior. :paramtype restype: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2064,7 +2065,7 @@ def get_service_properties( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2100,14 +2101,14 @@ def get_service_properties( @distributed_trace def put_service_properties( self, - properties, # type: Any + properties, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Puts storage service properties. :param properties: - :type properties: Any + :type properties: JSONType :keyword comp: The default value is "properties". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str @@ -2202,7 +2203,7 @@ def put_service_properties( def get_acls( self, **kwargs # type: Any ): - # type: (...) -> List[Any] + # type: (...) -> List[JSONType] """Gets storage ACLs for a container. :keyword comp: The default value is "acl". Note that overriding this default value may result @@ -2212,7 +2213,7 @@ def get_acls( result in unsupported behavior. :paramtype restype: str :return: list of JSON object - :rtype: list[Any] + :rtype: list[JSONType] :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2230,7 +2231,7 @@ def get_acls( } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2266,14 +2267,14 @@ def get_acls( @distributed_trace def put_acls( self, - properties, # type: List[Any] + properties, # type: List[JSONType] **kwargs # type: Any ): # type: (...) -> None """Puts storage ACLs for a container. :param properties: - :type properties: list[Any] + :type properties: list[JSONType] :keyword comp: The default value is "acl". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str @@ -2335,7 +2336,7 @@ def put_acls( def list_blobs( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Lists blobs in a storage container. :keyword comp: The default value is "list". Note that overriding this default value may result @@ -2345,7 +2346,7 @@ def list_blobs( result in unsupported behavior. :paramtype restype: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2409,7 +2410,7 @@ def list_blobs( "ServiceEndpoint": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2445,7 +2446,7 @@ def list_blobs( @distributed_trace def json_input( self, - properties, # type: Any + properties, # type: JSONType **kwargs # type: Any ): # type: (...) -> None @@ -2453,7 +2454,7 @@ def json_input( number 42. :param properties: - :type properties: Any + :type properties: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2497,11 +2498,11 @@ def json_input( def json_output( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """A Swagger with XML that has one operation that returns JSON. ID number 42. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2512,7 +2513,7 @@ def json_output( "id": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2544,12 +2545,12 @@ def json_output( def get_xms_text( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get back an XML object with an x-ms-text property, which should translate to the returned object's 'language' property being 'english' and its 'content' property being 'I am text'. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2561,7 +2562,7 @@ def get_xms_text( "language": "str" # Optional. Returned value should be 'english'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2593,11 +2594,11 @@ def get_xms_text( def get_bytes( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get an XML document with binary property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2608,7 +2609,7 @@ def get_bytes( "Bytes": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2639,14 +2640,14 @@ def get_bytes( @distributed_trace def put_binary( self, - slideshow, # type: Any + slideshow, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put an XML document with binary property. :param slideshow: - :type slideshow: Any + :type slideshow: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError @@ -2690,11 +2691,11 @@ def put_binary( def get_uri( self, **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Get an XML document with uri property. :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -2705,7 +2706,7 @@ def get_uri( "Url": str # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) @@ -2736,14 +2737,14 @@ def get_uri( @distributed_trace def put_uri( self, - model, # type: Any + model, # type: JSONType **kwargs # type: Any ): # type: (...) -> None """Put an XML document with uri property. :param model: - :type model: Any + :type model: JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py index 3d0bf089051..206452c9160 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py @@ -28,6 +28,7 @@ ) T = TypeVar("T") +JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,13 +51,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[Any]: + async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSONType]: """Gets pets by id. :param pet_id: pet id. :type pet_id: str :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -68,7 +69,7 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[Any]: "name": "str" # Optional. Gets the Pet by id. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = { 401: ClientAuthenticationError, 409: ResourceExistsError, @@ -106,13 +107,13 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[Any]: get_pet_by_id.metadata = {"url": "/errorStatusCodes/Pets/{petId}/GetPet"} # type: ignore @distributed_trace_async - async def do_something(self, what_action: str, **kwargs: Any) -> Any: + async def do_something(self, what_action: str, **kwargs: Any) -> JSONType: """Asks pet to do something. :param what_action: what action the pet should do. :type what_action: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -123,7 +124,7 @@ async def do_something(self, what_action: str, **kwargs: Any) -> Any: "actionResponse": "str" # Optional. action feedback. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py index 2cfb24466fe..cc5fcbb93bf 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py @@ -29,6 +29,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar("T") + JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -138,13 +139,13 @@ def get_pet_by_id( pet_id, # type: str **kwargs # type: Any ): - # type: (...) -> Optional[Any] + # type: (...) -> Optional[JSONType] """Gets pets by id. :param pet_id: pet id. :type pet_id: str :return: JSON object - :rtype: Any or None + :rtype: JSONType or None :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -156,7 +157,7 @@ def get_pet_by_id( "name": "str" # Optional. Gets the Pet by id. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Any]] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] error_map = { 401: ClientAuthenticationError, 409: ResourceExistsError, @@ -199,13 +200,13 @@ def do_something( what_action, # type: str **kwargs # type: Any ): - # type: (...) -> Any + # type: (...) -> JSONType """Asks pet to do something. :param what_action: what action the pet should do. :type what_action: str :return: JSON object - :rtype: Any + :rtype: JSONType :raises: ~azure.core.exceptions.HttpResponseError Example: @@ -216,7 +217,7 @@ def do_something( "actionResponse": "str" # Optional. action feedback. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop("cls", None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, From 0a78b2a11ea8e1f4c3b45a9a3ab580a2e39171e8 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 4 Nov 2021 09:11:32 -0700 Subject: [PATCH 16/23] add body kwarg to body params before serialization --- autorest/codegen/__init__.py | 2 +- autorest/codegen/models/code_model.py | 1 + autorest/codegen/models/operation.py | 37 +++++++++++++++++- autorest/codegen/models/parameter.py | 1 + .../codegen/serializers/builder_serializer.py | 39 +++++++------------ 5 files changed, 52 insertions(+), 28 deletions(-) diff --git a/autorest/codegen/__init__.py b/autorest/codegen/__init__.py index 5ec83b69742..a4f2bd9fd59 100644 --- a/autorest/codegen/__init__.py +++ b/autorest/codegen/__init__.py @@ -31,9 +31,9 @@ def _build_convenience_layer(yaml_data: Dict[str, Any], code_model: CodeModel) - code_model.sort_schemas() if code_model.options["show_operations"]: - code_model.link_operation_to_request_builder() code_model.add_schema_link_to_operation() code_model.generate_single_parameter_from_multiple_content_types_operation() + code_model.link_operation_to_request_builder() # LRO operation code_model.format_lro_operations() code_model.remove_next_operation() diff --git a/autorest/codegen/models/code_model.py b/autorest/codegen/models/code_model.py index ddca92c04d7..87591630f0b 100644 --- a/autorest/codegen/models/code_model.py +++ b/autorest/codegen/models/code_model.py @@ -383,3 +383,4 @@ def link_operation_to_request_builder(self) -> None: if isinstance(operation, LROOperation): request_builder.name = request_builder.name + "_initial" operation.request_builder = request_builder + operation.link_body_kwargs_to_body_params() diff --git a/autorest/codegen/models/operation.py b/autorest/codegen/models/operation.py index ddd8394a6e4..8d3da31e352 100644 --- a/autorest/codegen/models/operation.py +++ b/autorest/codegen/models/operation.py @@ -10,12 +10,13 @@ from .base_builder import BaseBuilder, create_parameters from .imports import FileImport, ImportType, TypingSection from .schema_response import SchemaResponse -from .parameter import get_parameter +from .parameter import Parameter, get_parameter from .parameter_list import ParameterList, get_parameter_list from .base_schema import BaseSchema from .object_schema import ObjectSchema from .request_builder import RequestBuilder from .schema_request import SchemaRequest +from .primitive_schemas import IOSchema _LOGGER = logging.getLogger(__name__) @@ -228,6 +229,40 @@ def imports(self, async_mode: bool) -> FileImport: file_import.define_mypy_type("JSONType", "Any") return file_import + def _get_body_param_from_body_kwarg(self, body_kwarg: Parameter) -> Parameter: + # determine which of the body parameters returned from m4 corresponds to this body_kwarg + if not self.multiple_content_type_parameters.has_body: + return self.parameters.body[0] + if body_kwarg.serialized_name == "data": + return next(p for p in self.multiple_content_type_parameters.body if p.is_data_input) + if body_kwarg.serialized_name == "files": + return next(p for p in self.multiple_content_type_parameters.body if p.is_multipart) + if body_kwarg.serialized_name == "json": + # first check if there's any non-binary. In the case of multiple content types, there's + # usually one binary (for content), and one schema parameter (for json) + try: + return next( + p for p in self.multiple_content_type_parameters.body + if not isinstance(p.schema, IOSchema) + ) + except StopIteration: + return next(p for p in self.multiple_content_type_parameters.body if p.is_json_parameter) + return self.multiple_content_type_parameters.body[0] + + def link_body_kwargs_to_body_params(self) -> None: + if not self.parameters.has_body: + return + body_kwargs = [ + p for p in self.request_builder.parameters.body + if p.content_types + ] + if len(body_kwargs) == 1: + self.parameters.body[0].body_kwargs = [body_kwargs[0]] + return + for body_kwarg in body_kwargs: + body_param = self._get_body_param_from_body_kwarg(body_kwarg) + body_param.body_kwargs.append(body_kwarg) + def convert_multiple_content_type_parameters(self) -> None: type_annot = ", ".join([ param.schema.operation_type_annotation diff --git a/autorest/codegen/models/parameter.py b/autorest/codegen/models/parameter.py index c314a508ad4..c4f69319313 100644 --- a/autorest/codegen/models/parameter.py +++ b/autorest/codegen/models/parameter.py @@ -95,6 +95,7 @@ def __init__( self.is_multipart = yaml_data.get("language", {}).get("python", {}).get("multipart", False) self.is_data_input = yaml_data.get("isPartialBody", False) and not self.is_multipart self.content_types = content_types or [] + self.body_kwargs: List[Parameter] = [] def __hash__(self) -> int: return hash(self.serialized_name) diff --git a/autorest/codegen/serializers/builder_serializer.py b/autorest/codegen/serializers/builder_serializer.py index 810bb86c9d4..489220bad97 100644 --- a/autorest/codegen/serializers/builder_serializer.py +++ b/autorest/codegen/serializers/builder_serializer.py @@ -157,26 +157,6 @@ def _content_type_docstring(builder: BuilderType) -> str: ) return content_type_str -def _get_body_param_from_body_kwarg(builder: BuilderType, body_kwarg: str) -> Parameter: - # determine which of the body parameters returned from m4 corresponds to this body_kwarg - if not builder.multiple_content_type_parameters.has_body: - return builder.parameters.body[0] - if body_kwarg == "data": - return next(p for p in builder.multiple_content_type_parameters if p.is_data_input) - if body_kwarg == "files": - return next(p for p in builder.multiple_content_type_parameters if p.is_multipart) - if body_kwarg == "json": - # first check if there's any non-binary. In the case of multiple content types, there's - # usually one binary (for content), and one schema parameter (for json) - try: - return next( - p for p in builder.multiple_content_type_parameters - if not isinstance(p.schema, IOSchema) - ) - except StopIteration: - return next(p for p in builder.multiple_content_type_parameters if p.is_json_parameter) - return builder.multiple_content_type_parameters[0] - class _BuilderSerializerProtocol(ABC): @property @abstractmethod @@ -771,16 +751,23 @@ def _serialize_body_parameters( self, builder: BuilderType, ) -> List[str]: retval = [] - body_groups = [ + body_kwargs = [ p for p in builder.request_builder.parameters.body if p.content_types ] - if len(body_groups) == 1: - retval.extend(self._set_body_content_kwarg(builder, builder.parameters.body[0], body_groups[0])) + builder_params = [] + if builder.parameters.has_body: + builder_params += builder.parameters.body + if builder.multiple_content_type_parameters.has_body: + builder_params += builder.multiple_content_type_parameters.body + if len(body_kwargs) == 1: + retval.extend(self._set_body_content_kwarg(builder, builder.parameters.body[0], body_kwargs[0])) else: - - for idx, body_kwarg in enumerate(body_groups): - body_param = _get_body_param_from_body_kwarg(builder, body_kwarg.serialized_name) + for idx, body_kwarg in enumerate(body_kwargs): + body_param = next( + b for b in builder_params + if body_kwarg in b.body_kwargs + ) if_statement = "if" if idx == 0 else "elif" retval.append( f'{if_statement} content_type.split(";")[0] in {body_kwarg.pre_semicolon_content_types}:' From 24db60d4f594932be6607ec4e5c0ed7b1445c983 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 4 Nov 2021 09:23:01 -0700 Subject: [PATCH 17/23] update unittests --- test/unittests/test_optional_return_type.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/unittests/test_optional_return_type.py b/test/unittests/test_optional_return_type.py index 418546ff686..2403c9204e3 100644 --- a/test/unittests/test_optional_return_type.py +++ b/test/unittests/test_optional_return_type.py @@ -41,6 +41,7 @@ def lro_operation(code_model): api_versions=set(["2020-05-01"]), parameters=ParameterList(code_model), multiple_content_type_parameters=ParameterList(code_model), + schema_requests=[SchemaRequest({}, ["application/json"], ParameterList(code_model))] ) @pytest.fixture @@ -53,6 +54,7 @@ def paging_operation(code_model): api_versions=set(["2020-05-01"]), parameters=ParameterList(code_model), multiple_content_type_parameters=ParameterList(code_model), + schema_requests=[SchemaRequest({}, ["application/json"], ParameterList(code_model))] ) def test_success_with_body_and_fail_no_body(operation): From 2b8b30c146beac24f3a078b88d82f2399828c191 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 4 Nov 2021 10:03:34 -0700 Subject: [PATCH 18/23] add json type hints for io json params --- autorest/codegen/models/parameter.py | 19 ++++++++++++++++--- .../aio/operations/_operations.py | 6 +++--- .../operations/_operations.py | 6 +++--- .../aio/operations/_operations.py | 4 ++-- .../operations/_operations.py | 4 ++-- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/autorest/codegen/models/parameter.py b/autorest/codegen/models/parameter.py index c4f69319313..316cce1e43d 100644 --- a/autorest/codegen/models/parameter.py +++ b/autorest/codegen/models/parameter.py @@ -14,6 +14,7 @@ from .constant_schema import ConstantSchema from .object_schema import ObjectSchema from .property import Property +from .primitive_schemas import IOSchema _LOGGER = logging.getLogger(__name__) @@ -208,10 +209,18 @@ def implementation(self) -> str: return "Method" return self._implementation + @property + def _is_io_json(self): + return any( + k for k in self.body_kwargs if k.serialized_name == "json" + ) and isinstance(self.schema, IOSchema) + def _default_value(self) -> Tuple[Optional[Any], str, str]: type_annot = self.multiple_content_types_type_annot or self.schema.operation_type_annotation + if self._is_io_json: + type_annot = f"Union[{type_annot}, JSONType]" any_types = ["Any", "JSONType"] - if not self.required and type_annot not in any_types: + if not self.required and type_annot not in any_types and not self._is_io_json: type_annot = f"Optional[{type_annot}]" if self.client_default_value is not None: @@ -264,7 +273,10 @@ def serialization_type(self) -> str: @property def docstring_type(self) -> str: - return self.multiple_content_types_docstring_type or self.schema.docstring_type + retval = self.multiple_content_types_docstring_type or self.schema.docstring_type + if self._is_io_json: + retval += " or JSONType" + return retval @property def has_default_value(self): @@ -344,8 +356,9 @@ def imports(self) -> FileImport: file_import = self.schema.imports() if not self.required: file_import.add_from_import("typing", "Optional", ImportType.STDLIB, TypingSection.CONDITIONAL) - if self.has_multiple_content_types: + if self.has_multiple_content_types or self._is_io_json: file_import.add_from_import("typing", "Union", ImportType.STDLIB, TypingSection.CONDITIONAL) + return file_import class ParameterOnlyPathAndBodyPositional(Parameter): diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py index 5f99631cb17..de626ec4b49 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union import warnings from azure.core.exceptions import ( @@ -47,11 +47,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def file(self, file_param: IO, **kwargs: Any) -> None: + async def file(self, file_param: Union[IO, JSONType], **kwargs: Any) -> None: """Uploading json file. :param file_param: JSON file with payload { "more": "cowbell" }. - :type file_param: IO + :type file_param: IO or JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py index 25b0e181c9f..deb0d62e018 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py @@ -24,7 +24,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union T = TypeVar("T") JSONType = Any @@ -98,14 +98,14 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def file( self, - file_param, # type: IO + file_param, # type: Union[IO, JSONType] **kwargs # type: Any ): # type: (...) -> None """Uploading json file. :param file_param: JSON file with payload { "more": "cowbell" }. - :type file_param: IO + :type file_param: IO or JSONType :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py index 5a7999ba12d..14583d18461 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/operations/_operations.py @@ -209,12 +209,12 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs content_type_with_encoding.metadata = {"url": "/mediatypes/contentTypeWithEncoding"} # type: ignore @distributed_trace_async - async def binary_body_with_two_content_types(self, message: IO, **kwargs: Any) -> str: + async def binary_body_with_two_content_types(self, message: Union[IO, JSONType], **kwargs: Any) -> str: """Binary body with two content types. Pass in of {'hello': 'world'} for the application/json content type, and a byte stream of 'hello, world!' for application/octet-stream. :param message: The payload body. - :type message: IO + :type message: IO or JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py index 08b85183f51..84a049e08a6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/operations/_operations.py @@ -366,7 +366,7 @@ def content_type_with_encoding( @distributed_trace def binary_body_with_two_content_types( self, - message, # type: IO + message, # type: Union[IO, JSONType] **kwargs # type: Any ): # type: (...) -> str @@ -374,7 +374,7 @@ def binary_body_with_two_content_types( content type, and a byte stream of 'hello, world!' for application/octet-stream. :param message: The payload body. - :type message: IO + :type message: IO or JSONType :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError From 532ec05a0a04797cd5ab521a5dc97d0c78cce897 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 4 Nov 2021 10:23:44 -0700 Subject: [PATCH 19/23] skip regeneration --- eng/pipelines/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 7fe8bb11544..892af931ee0 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -65,14 +65,6 @@ jobs: - script: | pytest test/unittests displayName: 'Unit tests' - - script: | - inv regenerate - displayName: 'Regenerate Code' - - script: | - git add -A # 'add' first so 'diff' includes untracked files - git diff --staged -w - displayName: 'Diff regeneration' - - task: UsePythonVersion@0 displayName: 'Use Python $(PythonVersion)' From ed822d1400e3c7d35dd804073b411fec0b19ac8b Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 4 Nov 2021 10:34:55 -0700 Subject: [PATCH 20/23] fix legacy media types test --- .../legacy/AcceptanceTests/asynctests/test_media_types.py | 2 +- test/vanilla/legacy/AcceptanceTests/test_media_types.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py b/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py index e189785d38c..400c21db8f0 100644 --- a/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py +++ b/test/vanilla/legacy/AcceptanceTests/asynctests/test_media_types.py @@ -72,7 +72,7 @@ async def test_json_no_accept_header(self, client): @pytest.mark.asyncio async def test_binary_body_two_content_types(self, client): - json_input = {"hello":"world"} + json_input = json.dumps({"hello":"world"}) await client.binary_body_with_two_content_types(json_input, content_type="application/json") content = b"hello, world" diff --git a/test/vanilla/legacy/AcceptanceTests/test_media_types.py b/test/vanilla/legacy/AcceptanceTests/test_media_types.py index 49ff5a4e5f4..7c31ae3f55e 100644 --- a/test/vanilla/legacy/AcceptanceTests/test_media_types.py +++ b/test/vanilla/legacy/AcceptanceTests/test_media_types.py @@ -63,7 +63,7 @@ def test_json_no_accept_header(self, client): client.analyze_body_no_accept_header(input=json_input) def test_binary_body_two_content_types(self, client): - json_input = {"hello":"world"} + json_input = json.dumps({"hello":"world"}) client.binary_body_with_two_content_types(json_input, content_type="application/json") content = b"hello, world" From 61df9617aa33c6fe4e2e6e4887b8585f6f61209c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 4 Nov 2021 10:35:14 -0700 Subject: [PATCH 21/23] skip non vanila tests --- eng/pipelines/ci.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 892af931ee0..a0d7f955867 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -76,39 +76,6 @@ jobs: pip install tox coverage displayName: "Install Env Specific Reqs in Target PyVersion $(PythonVersion)" - - script: | - cd $(TestFolder)/azure/legacy - tox -e ci - displayName: 'Execute legacy "azure" Tests - Python $(PythonVersion)' - - task: PublishTestResults@2 - condition: always() - displayName: 'Publish legacy "azure" Test Results' - inputs: - testRunTitle: "$(OSName) Python $(PythonVersion) - legacy azure" - searchFolder: "$(TestFolder)/azure/legacy" - - - script: | - cd $(TestFolder)/azure/low-level - tox -e ci - displayName: 'Execute low-level "azure" Tests - Python $(PythonVersion)' - - task: PublishTestResults@2 - condition: always() - displayName: 'Publish low-level "azure" Test Results' - inputs: - testRunTitle: "$(OSName) Python $(PythonVersion) - low-level azure" - searchFolder: "$(TestFolder)/azure/low-level" - - - script: | - cd $(TestFolder)/azure/version-tolerant - tox -e ci - displayName: 'Execute version-tolerant "azure" Tests - Python $(PythonVersion)' - - task: PublishTestResults@2 - condition: always() - displayName: 'Publish version-tolerant "azure" Test Results' - inputs: - testRunTitle: "$(OSName) Python $(PythonVersion) - version-tolerant azure" - searchFolder: "$(TestFolder)/azure/version-tolerant" - - script: | cd $(TestFolder)/vanilla/legacy tox -e ci From 017a2f6702ee6f0d5836bf74c9ed5287f64ea83e Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 4 Nov 2021 10:49:49 -0700 Subject: [PATCH 22/23] pass json to upload file test --- .../version-tolerant/AcceptanceTests/asynctests/test_binary.py | 2 +- test/vanilla/version-tolerant/AcceptanceTests/test_binary.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_binary.py b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_binary.py index a92159d0d4a..a11c47e602e 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_binary.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_binary.py @@ -35,7 +35,7 @@ async def client(): @pytest.mark.asyncio async def test_upload_file(client): - await client.upload.file(b'{"more": "cowbell"}') + await client.upload.file({"more": "cowbell"}) @pytest.mark.asyncio async def test_upload_binary(client): diff --git a/test/vanilla/version-tolerant/AcceptanceTests/test_binary.py b/test/vanilla/version-tolerant/AcceptanceTests/test_binary.py index da1980b9187..339362a1691 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/test_binary.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/test_binary.py @@ -34,7 +34,7 @@ def client(): def test_upload_file(client): - client.upload.file(json.dumps({"more": "cowbell"})) + client.upload.file({"more": "cowbell"}) def test_upload_binary(client): client.upload.binary(b"Hello, world!") From 448191e3504df2a75d8df5c9d123a25994d93f8c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 4 Nov 2021 10:58:56 -0700 Subject: [PATCH 23/23] revert skipped steps in ci --- eng/pipelines/ci.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index a0d7f955867..7fe8bb11544 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -65,6 +65,14 @@ jobs: - script: | pytest test/unittests displayName: 'Unit tests' + - script: | + inv regenerate + displayName: 'Regenerate Code' + - script: | + git add -A # 'add' first so 'diff' includes untracked files + git diff --staged -w + displayName: 'Diff regeneration' + - task: UsePythonVersion@0 displayName: 'Use Python $(PythonVersion)' @@ -76,6 +84,39 @@ jobs: pip install tox coverage displayName: "Install Env Specific Reqs in Target PyVersion $(PythonVersion)" + - script: | + cd $(TestFolder)/azure/legacy + tox -e ci + displayName: 'Execute legacy "azure" Tests - Python $(PythonVersion)' + - task: PublishTestResults@2 + condition: always() + displayName: 'Publish legacy "azure" Test Results' + inputs: + testRunTitle: "$(OSName) Python $(PythonVersion) - legacy azure" + searchFolder: "$(TestFolder)/azure/legacy" + + - script: | + cd $(TestFolder)/azure/low-level + tox -e ci + displayName: 'Execute low-level "azure" Tests - Python $(PythonVersion)' + - task: PublishTestResults@2 + condition: always() + displayName: 'Publish low-level "azure" Test Results' + inputs: + testRunTitle: "$(OSName) Python $(PythonVersion) - low-level azure" + searchFolder: "$(TestFolder)/azure/low-level" + + - script: | + cd $(TestFolder)/azure/version-tolerant + tox -e ci + displayName: 'Execute version-tolerant "azure" Tests - Python $(PythonVersion)' + - task: PublishTestResults@2 + condition: always() + displayName: 'Publish version-tolerant "azure" Test Results' + inputs: + testRunTitle: "$(OSName) Python $(PythonVersion) - version-tolerant azure" + searchFolder: "$(TestFolder)/azure/version-tolerant" + - script: | cd $(TestFolder)/vanilla/legacy tox -e ci