From 74ef61229ad72843f4ed90c78847682e28c895f4 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 26 May 2020 11:30:23 -0400 Subject: [PATCH 1/4] fixed async docs and typing --- .../codegen/templates/lro_operation.py.jinja2 | 6 +- .../_lr_os_custom_header_operations_async.py | 24 +- .../_lro_retrys_operations_async.py | 42 +-- .../_lros_operations_async.py | 246 +++++++++--------- .../_lrosads_operations_async.py | 156 +++++------ .../_paging_operations_async.py | 6 +- .../_storage_accounts_operations_async.py | 6 +- ...ultiapi_service_client_operations_async.py | 6 +- ...ultiapi_service_client_operations_async.py | 6 +- 9 files changed, 249 insertions(+), 249 deletions(-) diff --git a/autorest/codegen/templates/lro_operation.py.jinja2 b/autorest/codegen/templates/lro_operation.py.jinja2 index 4b69dbee961..7727e4fa676 100644 --- a/autorest/codegen/templates/lro_operation.py.jinja2 +++ b/autorest/codegen/templates/lro_operation.py.jinja2 @@ -5,8 +5,8 @@ {% set poller = "AsyncLROPoller" if async_mode else "LROPoller" %} {% set operation_name = "begin_"+operation.python_name %} {% macro return_docstring() %} -:return: {{ "" if async_mode else "An instance of LROPoller that returns either " }}{{ operation.responses[0].schema.docstring_text if operation.responses[0].has_body else "None"}}{{ "," if async_mode }} or the result of cls(response) -:rtype: {{"" if async_mode else "~azure.core.polling.LROPoller["}}{{ operation.responses[0].schema.docstring_type if operation.responses[0].has_body else "None" }}{{ "" if async_mode else "]" }}{% endmacro %} +:return: An instance of {{ "Async" if async_mode }}LROPoller that returns either {{ operation.responses[0].schema.docstring_text if operation.responses[0].has_body else "None"}} or the result of cls(response) +:rtype: ~azure.core.polling.{{ "Async" if async_mode }}LROPoller[{{ operation.responses[0].schema.docstring_type if operation.responses[0].has_body else "None" }}]{% endmacro %} {% macro param_documentation_string(parameter) %}:param {{ parameter.serialized_name }}: {{ parameter.description }}{% endmacro %} {% macro response_headers(response) %} response_headers = { @@ -20,7 +20,7 @@ response_headers = { {% if code_model.options['tracing'] %} {{ trace_decorator }} {% endif %} -{% set return_type_wrapper = "" if async_mode else "LROPoller" %} +{% set return_type_wrapper = "AsyncLROPoller" if async_mode else "LROPoller" %} {{ op_tools.method_signature(operation, operation_name, async_mode=async_mode, coroutine=async_mode, return_type_wrapper=return_type_wrapper) }} {%- if not async_mode %} {# overriding sync_return_type_annotation because we know if it's sync, it's return type is just LROPoller #} diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lr_os_custom_header_operations_async.py b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lr_os_custom_header_operations_async.py index f733757f00e..36a2c87ed9a 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lr_os_custom_header_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lr_os_custom_header_operations_async.py @@ -97,7 +97,7 @@ async def begin_put_async_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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- @@ -111,8 +111,8 @@ async def begin_put_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -213,7 +213,7 @@ async def begin_put201_creating_succeeded200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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 @@ -227,8 +227,8 @@ async def begin_put201_creating_succeeded200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -319,7 +319,7 @@ async def begin_post202_retry200( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -332,8 +332,8 @@ async def begin_post202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -422,7 +422,7 @@ async def begin_post_async_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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- @@ -436,8 +436,8 @@ async def begin_post_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lro_retrys_operations_async.py b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lro_retrys_operations_async.py index 880f701ff66..02f33682797 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lro_retrys_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lro_retrys_operations_async.py @@ -98,7 +98,7 @@ async def begin_put201_creating_succeeded200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -111,8 +111,8 @@ async def begin_put201_creating_succeeded200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -207,7 +207,7 @@ async def begin_put_async_relative_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -220,8 +220,8 @@ async def begin_put_async_relative_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -314,7 +314,7 @@ async def _delete_provisioning202_accepted200_succeeded_initial( async def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -325,8 +325,8 @@ async def begin_delete_provisioning202_accepted200_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -409,7 +409,7 @@ async def _delete202_retry200_initial( async def begin_delete202_retry200( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -419,8 +419,8 @@ async def begin_delete202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -497,7 +497,7 @@ async def _delete_async_relative_retry_succeeded_initial( async def begin_delete_async_relative_retry_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -507,8 +507,8 @@ async def begin_delete_async_relative_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -595,7 +595,7 @@ async def begin_post202_retry200( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -607,8 +607,8 @@ async def begin_post202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -697,7 +697,7 @@ async def begin_post_async_relative_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -710,8 +710,8 @@ async def begin_post_async_relative_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lros_operations_async.py b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lros_operations_async.py index 37ca98390ab..2186491c006 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lros_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lros_operations_async.py @@ -95,7 +95,7 @@ async def begin_put200_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -107,8 +107,8 @@ async def begin_put200_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -199,7 +199,7 @@ async def begin_put201_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -211,8 +211,8 @@ async def begin_put201_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -299,7 +299,7 @@ async def _post202_list_initial( async def begin_post202_list( self, **kwargs - ) -> List["models.Product"]: + ) -> AsyncLROPoller[List["models.Product"]]: """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -309,8 +309,8 @@ async def begin_post202_list( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: list of Product, or the result of cls(response) - :rtype: list[~lro.models.Product] + :return: An instance of AsyncLROPoller that returns either list of Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~lro.models.Product]] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -400,7 +400,7 @@ async def begin_put200_succeeded_no_state( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -412,8 +412,8 @@ async def begin_put200_succeeded_no_state( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -504,7 +504,7 @@ async def begin_put202_retry200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -517,8 +517,8 @@ async def begin_put202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -614,7 +614,7 @@ async def begin_put201_creating_succeeded200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -627,8 +627,8 @@ async def begin_put201_creating_succeeded200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -719,7 +719,7 @@ async def begin_put200_updating_succeeded204( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -732,8 +732,8 @@ async def begin_put200_updating_succeeded204( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -829,7 +829,7 @@ async def begin_put201_creating_failed200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -842,8 +842,8 @@ async def begin_put201_creating_failed200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -934,7 +934,7 @@ async def begin_put200_acceptedcanceled200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -947,8 +947,8 @@ async def begin_put200_acceptedcanceled200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1041,7 +1041,7 @@ async def begin_put_no_header_in_retry( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -1053,8 +1053,8 @@ async def begin_put_no_header_in_retry( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1152,7 +1152,7 @@ async def begin_put_async_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -1165,8 +1165,8 @@ async def begin_put_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1265,7 +1265,7 @@ async def begin_put_async_no_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -1278,8 +1278,8 @@ async def begin_put_async_no_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1378,7 +1378,7 @@ async def begin_put_async_retry_failed( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -1391,8 +1391,8 @@ async def begin_put_async_retry_failed( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1491,7 +1491,7 @@ async def begin_put_async_no_retrycanceled( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -1504,8 +1504,8 @@ async def begin_put_async_no_retrycanceled( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1602,7 +1602,7 @@ async def begin_put_async_no_header_in_retry( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -1615,8 +1615,8 @@ async def begin_put_async_no_header_in_retry( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1710,7 +1710,7 @@ async def begin_put_non_resource( self, sku: Optional["models.Sku"] = None, **kwargs - ) -> "models.Sku": + ) -> AsyncLROPoller["models.Sku"]: """Long running put request with non resource. :param sku: sku to put. @@ -1721,8 +1721,8 @@ async def begin_put_non_resource( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Sku, or the result of cls(response) - :rtype: ~lro.models.Sku + :return: An instance of AsyncLROPoller that returns either Sku or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Sku] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1813,7 +1813,7 @@ async def begin_put_async_non_resource( self, sku: Optional["models.Sku"] = None, **kwargs - ) -> "models.Sku": + ) -> AsyncLROPoller["models.Sku"]: """Long running put request with non resource. :param sku: Sku to put. @@ -1824,8 +1824,8 @@ async def begin_put_async_non_resource( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Sku, or the result of cls(response) - :rtype: ~lro.models.Sku + :return: An instance of AsyncLROPoller that returns either Sku or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Sku] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1918,7 +1918,7 @@ async def begin_put_sub_resource( self, provisioning_state: Optional[str] = None, **kwargs - ) -> "models.SubProduct": + ) -> AsyncLROPoller["models.SubProduct"]: """Long running put request with sub resource. :param provisioning_state: @@ -1929,8 +1929,8 @@ async def begin_put_sub_resource( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: SubProduct, or the result of cls(response) - :rtype: ~lro.models.SubProduct + :return: An instance of AsyncLROPoller that returns either SubProduct or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.SubProduct] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2023,7 +2023,7 @@ async def begin_put_async_sub_resource( self, provisioning_state: Optional[str] = None, **kwargs - ) -> "models.SubProduct": + ) -> AsyncLROPoller["models.SubProduct"]: """Long running put request with sub resource. :param provisioning_state: @@ -2034,8 +2034,8 @@ async def begin_put_async_sub_resource( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: SubProduct, or the result of cls(response) - :rtype: ~lro.models.SubProduct + :return: An instance of AsyncLROPoller that returns either SubProduct or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.SubProduct] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2123,7 +2123,7 @@ async def _delete_provisioning202_accepted200_succeeded_initial( async def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -2134,8 +2134,8 @@ async def begin_delete_provisioning202_accepted200_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2226,7 +2226,7 @@ async def _delete_provisioning202_deleting_failed200_initial( async def begin_delete_provisioning202_deleting_failed200( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -2237,8 +2237,8 @@ async def begin_delete_provisioning202_deleting_failed200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2329,7 +2329,7 @@ async def _delete_provisioning202_deletingcanceled200_initial( async def begin_delete_provisioning202_deletingcanceled200( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -2340,8 +2340,8 @@ async def begin_delete_provisioning202_deletingcanceled200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2420,7 +2420,7 @@ async def _delete204_succeeded_initial( async def begin_delete204_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete succeeds and returns right away. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2429,8 +2429,8 @@ async def begin_delete204_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2513,7 +2513,7 @@ async def _delete202_retry200_initial( async def begin_delete202_retry200( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -2523,8 +2523,8 @@ async def begin_delete202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2610,7 +2610,7 @@ async def _delete202_no_retry204_initial( async def begin_delete202_no_retry204( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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’. @@ -2620,8 +2620,8 @@ async def begin_delete202_no_retry204( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2700,7 +2700,7 @@ async def _delete_no_header_in_retry_initial( async def begin_delete_no_header_in_retry( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. @@ -2710,8 +2710,8 @@ async def begin_delete_no_header_in_retry( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2787,7 +2787,7 @@ async def _delete_async_no_header_in_retry_initial( async def begin_delete_async_no_header_in_retry( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -2797,8 +2797,8 @@ async def begin_delete_async_no_header_in_retry( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2875,7 +2875,7 @@ async def _delete_async_retry_succeeded_initial( async def begin_delete_async_retry_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2885,8 +2885,8 @@ async def begin_delete_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2963,7 +2963,7 @@ async def _delete_async_no_retry_succeeded_initial( async def begin_delete_async_no_retry_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2973,8 +2973,8 @@ async def begin_delete_async_no_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3051,7 +3051,7 @@ async def _delete_async_retry_failed_initial( async def begin_delete_async_retry_failed( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3061,8 +3061,8 @@ async def begin_delete_async_retry_failed( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3139,7 +3139,7 @@ async def _delete_async_retrycanceled_initial( async def begin_delete_async_retrycanceled( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3149,8 +3149,8 @@ async def begin_delete_async_retrycanceled( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3231,7 +3231,7 @@ async def _post200_with_payload_initial( async def begin_post200_with_payload( self, **kwargs - ) -> "models.Sku": + ) -> AsyncLROPoller["models.Sku"]: """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. @@ -3241,8 +3241,8 @@ async def begin_post200_with_payload( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Sku, or the result of cls(response) - :rtype: ~lro.models.Sku + :return: An instance of AsyncLROPoller that returns either Sku or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Sku] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3332,7 +3332,7 @@ async def begin_post202_retry200( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -3344,8 +3344,8 @@ async def begin_post202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3436,7 +3436,7 @@ async def begin_post202_no_retry204( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -3448,8 +3448,8 @@ async def begin_post202_no_retry204( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3533,7 +3533,7 @@ async def _post_double_headers_final_location_get_initial( async def begin_post_double_headers_final_location_get( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -3544,8 +3544,8 @@ async def begin_post_double_headers_final_location_get( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3624,7 +3624,7 @@ async def _post_double_headers_final_azure_header_get_initial( async def begin_post_double_headers_final_azure_header_get( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -3635,8 +3635,8 @@ async def begin_post_double_headers_final_azure_header_get( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3715,7 +3715,7 @@ async def _post_double_headers_final_azure_header_get_default_initial( async def begin_post_double_headers_final_azure_header_get_default( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -3726,8 +3726,8 @@ async def begin_post_double_headers_final_azure_header_get_default( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3825,7 +3825,7 @@ async def begin_post_async_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -3838,8 +3838,8 @@ async def begin_post_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3938,7 +3938,7 @@ async def begin_post_async_no_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -3951,8 +3951,8 @@ async def begin_post_async_no_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -4044,7 +4044,7 @@ async def begin_post_async_retry_failed( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -4057,8 +4057,8 @@ async def begin_post_async_retry_failed( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -4147,7 +4147,7 @@ async def begin_post_async_retrycanceled( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -4160,8 +4160,8 @@ async def begin_post_async_retrycanceled( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lrosads_operations_async.py b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lrosads_operations_async.py index 3533a151ed1..364e800e44b 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lrosads_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lrosads_operations_async.py @@ -98,7 +98,7 @@ async def begin_put_non_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 400 to the initial request. :param product: Product to put. @@ -109,8 +109,8 @@ async def begin_put_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -206,7 +206,7 @@ async def begin_put_non_retry201_creating400( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -218,8 +218,8 @@ async def begin_put_non_retry201_creating400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -315,7 +315,7 @@ async def begin_put_non_retry201_creating400_invalid_json( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -327,8 +327,8 @@ async def begin_put_non_retry201_creating400_invalid_json( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -423,7 +423,7 @@ async def begin_put_async_relative_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -435,8 +435,8 @@ async def begin_put_async_relative_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -521,7 +521,7 @@ async def _delete_non_retry400_initial( async def begin_delete_non_retry400( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 400 with an error body. :keyword callable cls: A custom type or function that will be passed the direct response @@ -530,8 +530,8 @@ async def begin_delete_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -607,7 +607,7 @@ async def _delete202_non_retry400_initial( async def begin_delete202_non_retry400( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 with a location header. :keyword callable cls: A custom type or function that will be passed the direct response @@ -616,8 +616,8 @@ async def begin_delete202_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -694,7 +694,7 @@ async def _delete_async_relative_retry400_initial( async def begin_delete_async_relative_retry400( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -704,8 +704,8 @@ async def begin_delete_async_relative_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -792,7 +792,7 @@ async def begin_post_non_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 400 with no error body. :param product: Product to put. @@ -803,8 +803,8 @@ async def begin_post_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -892,7 +892,7 @@ async def begin_post202_non_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 with a location header. :param product: Product to put. @@ -903,8 +903,8 @@ async def begin_post202_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -993,7 +993,7 @@ async def begin_post_async_relative_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -1005,8 +1005,8 @@ async def begin_post_async_relative_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1099,7 +1099,7 @@ async def begin_put_error201_no_provisioning_state_payload( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 201 to the initial request with no payload. :param product: Product to put. @@ -1110,8 +1110,8 @@ async def begin_put_error201_no_provisioning_state_payload( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1206,7 +1206,7 @@ async def begin_put_async_relative_retry_no_status( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -1219,8 +1219,8 @@ async def begin_put_async_relative_retry_no_status( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1320,7 +1320,7 @@ async def begin_put_async_relative_retry_no_status_payload( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -1333,8 +1333,8 @@ async def begin_put_async_relative_retry_no_status_payload( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1415,7 +1415,7 @@ async def _delete204_succeeded_initial( async def begin_delete204_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 204 to the initial request, indicating success. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1424,8 +1424,8 @@ async def begin_delete204_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1502,7 +1502,7 @@ async def _delete_async_relative_retry_no_status_initial( async def begin_delete_async_relative_retry_no_status( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1512,8 +1512,8 @@ async def begin_delete_async_relative_retry_no_status( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1600,7 +1600,7 @@ async def begin_post202_no_location( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -1612,8 +1612,8 @@ async def begin_post202_no_location( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1702,7 +1702,7 @@ async def begin_post_async_relative_retry_no_payload( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -1715,8 +1715,8 @@ async def begin_post_async_relative_retry_no_payload( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1806,7 +1806,7 @@ async def begin_put200_invalid_json( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -1818,8 +1818,8 @@ async def begin_put200_invalid_json( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1914,7 +1914,7 @@ async def begin_put_async_relative_retry_invalid_header( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -1927,8 +1927,8 @@ async def begin_put_async_relative_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2028,7 +2028,7 @@ async def begin_put_async_relative_retry_invalid_json_polling( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """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. @@ -2041,8 +2041,8 @@ async def begin_put_async_relative_retry_invalid_json_polling( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2127,7 +2127,7 @@ async def _delete202_retry_invalid_header_initial( async def begin_delete202_retry_invalid_header( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. @@ -2137,8 +2137,8 @@ async def begin_delete202_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2215,7 +2215,7 @@ async def _delete_async_relative_retry_invalid_header_initial( async def begin_delete_async_relative_retry_invalid_header( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2225,8 +2225,8 @@ async def begin_delete_async_relative_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2303,7 +2303,7 @@ async def _delete_async_relative_retry_invalid_json_polling_initial( async def begin_delete_async_relative_retry_invalid_json_polling( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2313,8 +2313,8 @@ async def begin_delete_async_relative_retry_invalid_json_polling( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2401,7 +2401,7 @@ async def begin_post202_retry_invalid_header( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -2413,8 +2413,8 @@ async def begin_post202_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2503,7 +2503,7 @@ async def begin_post_async_relative_retry_invalid_header( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -2516,8 +2516,8 @@ async def begin_post_async_relative_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2606,7 +2606,7 @@ async def begin_post_async_relative_retry_invalid_json_polling( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> 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. @@ -2619,8 +2619,8 @@ async def begin_post_async_relative_retry_invalid_json_polling( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/Paging/paging/aio/operations_async/_paging_operations_async.py b/test/azure/Expected/AcceptanceTests/Paging/paging/aio/operations_async/_paging_operations_async.py index f47473c0fa0..b1810244c5d 100644 --- a/test/azure/Expected/AcceptanceTests/Paging/paging/aio/operations_async/_paging_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Paging/paging/aio/operations_async/_paging_operations_async.py @@ -1026,7 +1026,7 @@ async def begin_get_multiple_pages_lro( client_request_id: Optional[str] = None, paging_get_multiple_pages_lro_options: Optional["models.PagingGetMultiplePagesLroOptions"] = None, **kwargs - ) -> "models.ProductResult": + ) -> AsyncLROPoller["models.ProductResult"]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: @@ -1039,8 +1039,8 @@ async def begin_get_multiple_pages_lro( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: ProductResult, or the result of cls(response) - :rtype: ~paging.models.ProductResult + :return: An instance of AsyncLROPoller that returns either ProductResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~paging.models.ProductResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_storage_accounts_operations_async.py b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_storage_accounts_operations_async.py index 96f2c036621..5fa3b106a73 100644 --- a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_storage_accounts_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_storage_accounts_operations_async.py @@ -166,7 +166,7 @@ async def begin_create( account_name: str, parameters: "models.StorageAccountCreateParameters", **kwargs - ) -> "models.StorageAccount": + ) -> AsyncLROPoller["models.StorageAccount"]: """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 @@ -186,8 +186,8 @@ async def begin_create( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: StorageAccount, or the result of cls(response) - :rtype: ~storage.models.StorageAccount + :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~storage.models.StorageAccount] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_multiapi_service_client_operations_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_multiapi_service_client_operations_async.py index 8f44bc04f80..cf974a74994 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_multiapi_service_client_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_multiapi_service_client_operations_async.py @@ -123,7 +123,7 @@ async def begin_test_lro( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. @@ -134,8 +134,8 @@ async def begin_test_lro( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~multiapi.v1.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~multiapi.v1.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_multiapi_service_client_operations_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_multiapi_service_client_operations_async.py index b729f2581f9..a0e22fc7e70 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_multiapi_service_client_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_multiapi_service_client_operations_async.py @@ -123,7 +123,7 @@ async def begin_test_lro( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. @@ -134,8 +134,8 @@ async def begin_test_lro( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~multiapiwithsubmodule.submodule.v1.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~multiapiwithsubmodule.submodule.v1.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] From 08d3953fec218c6019ee12221b30e8ad1f251436 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 26 May 2020 11:36:20 -0400 Subject: [PATCH 2/4] added return type to LROPoller sync typing --- .../codegen/templates/lro_operation.py.jinja2 | 3 +- .../_lr_os_custom_header_operations.py | 8 +- .../lro/operations/_lro_retrys_operations.py | 14 ++-- .../Lro/lro/operations/_lros_operations.py | 82 +++++++++---------- .../Lro/lro/operations/_lrosads_operations.py | 52 ++++++------ .../paging/operations/_paging_operations.py | 2 +- .../_storage_accounts_operations.py | 2 +- .../_multiapi_service_client_operations.py | 2 +- .../_multiapi_service_client_operations.py | 2 +- .../_multiapi_service_client_operations.py | 2 +- 10 files changed, 84 insertions(+), 85 deletions(-) diff --git a/autorest/codegen/templates/lro_operation.py.jinja2 b/autorest/codegen/templates/lro_operation.py.jinja2 index 7727e4fa676..7a5c98b6849 100644 --- a/autorest/codegen/templates/lro_operation.py.jinja2 +++ b/autorest/codegen/templates/lro_operation.py.jinja2 @@ -23,8 +23,7 @@ response_headers = { {% set return_type_wrapper = "AsyncLROPoller" if async_mode else "LROPoller" %} {{ op_tools.method_signature(operation, operation_name, async_mode=async_mode, coroutine=async_mode, return_type_wrapper=return_type_wrapper) }} {%- if not async_mode %} -{# overriding sync_return_type_annotation because we know if it's sync, it's return type is just LROPoller #} - # type: (...) -> LROPoller + {{ op_tools.sync_return_type_annotation(operation, return_type_wrapper) }} {% endif %} """{{ operation.summary if operation.summary else operation.description | wordwrap(width=95, break_long_words=False, wrapstring='\n') }} {% if operation.summary and operation.description %} diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py index 4fbd3ed5f9b..3b42c68efde 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py @@ -103,7 +103,7 @@ def begin_put_async_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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- @@ -221,7 +221,7 @@ def begin_put201_creating_succeeded200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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 @@ -329,7 +329,7 @@ def begin_post202_retry200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. @@ -434,7 +434,7 @@ def begin_post_async_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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- diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py index 005103e8602..c574ba82e58 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py @@ -104,7 +104,7 @@ def begin_put201_creating_succeeded200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -215,7 +215,7 @@ def begin_put_async_relative_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -324,7 +324,7 @@ def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -421,7 +421,7 @@ def begin_delete202_retry200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -511,7 +511,7 @@ def begin_delete_async_relative_retry_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -611,7 +611,7 @@ def begin_post202_retry200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. @@ -715,7 +715,7 @@ def begin_post_async_relative_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py index 431fbba40b6..a9e3f60120d 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py @@ -101,7 +101,7 @@ def begin_put200_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -207,7 +207,7 @@ def begin_put201_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -309,7 +309,7 @@ def begin_post202_list( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[List["models.Product"]] """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -412,7 +412,7 @@ def begin_put200_succeeded_no_state( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -518,7 +518,7 @@ def begin_put202_retry200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -630,7 +630,7 @@ def begin_put201_creating_succeeded200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -737,7 +737,7 @@ def begin_put200_updating_succeeded204( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -849,7 +849,7 @@ def begin_put201_creating_failed200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -956,7 +956,7 @@ def begin_put200_acceptedcanceled200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -1065,7 +1065,7 @@ def begin_put_no_header_in_retry( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -1178,7 +1178,7 @@ def begin_put_async_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -1293,7 +1293,7 @@ def begin_put_async_no_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -1408,7 +1408,7 @@ def begin_put_async_retry_failed( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -1523,7 +1523,7 @@ def begin_put_async_no_retrycanceled( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -1636,7 +1636,7 @@ def begin_put_async_no_header_in_retry( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -1746,7 +1746,7 @@ def begin_put_non_resource( sku=None, # type: Optional["models.Sku"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Sku"] """Long running put request with non resource. :param sku: sku to put. @@ -1851,7 +1851,7 @@ def begin_put_async_non_resource( sku=None, # type: Optional["models.Sku"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Sku"] """Long running put request with non resource. :param sku: Sku to put. @@ -1958,7 +1958,7 @@ def begin_put_sub_resource( provisioning_state=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.SubProduct"] """Long running put request with sub resource. :param provisioning_state: @@ -2065,7 +2065,7 @@ def begin_put_async_sub_resource( provisioning_state=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.SubProduct"] """Long running put request with sub resource. :param provisioning_state: @@ -2167,7 +2167,7 @@ def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -2272,7 +2272,7 @@ def begin_delete_provisioning202_deleting_failed200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -2377,7 +2377,7 @@ def begin_delete_provisioning202_deletingcanceled200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -2470,7 +2470,7 @@ def begin_delete204_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete succeeds and returns right away. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2565,7 +2565,7 @@ def begin_delete202_retry200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -2664,7 +2664,7 @@ def begin_delete202_no_retry204( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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’. @@ -2756,7 +2756,7 @@ def begin_delete_no_header_in_retry( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. @@ -2845,7 +2845,7 @@ def begin_delete_async_no_header_in_retry( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -2935,7 +2935,7 @@ def begin_delete_async_retry_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3025,7 +3025,7 @@ def begin_delete_async_no_retry_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3115,7 +3115,7 @@ def begin_delete_async_retry_failed( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3205,7 +3205,7 @@ def begin_delete_async_retrycanceled( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3299,7 +3299,7 @@ def begin_post200_with_payload( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Sku"] """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. @@ -3402,7 +3402,7 @@ def begin_post202_retry200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. @@ -3508,7 +3508,7 @@ def begin_post202_no_retry204( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -3607,7 +3607,7 @@ def begin_post_double_headers_final_location_get( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -3700,7 +3700,7 @@ def begin_post_double_headers_final_azure_header_get( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -3793,7 +3793,7 @@ def begin_post_double_headers_final_azure_header_get_default( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -3905,7 +3905,7 @@ def begin_post_async_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -4020,7 +4020,7 @@ def begin_post_async_no_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -4128,7 +4128,7 @@ def begin_post_async_retry_failed( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. @@ -4233,7 +4233,7 @@ def begin_post_async_retrycanceled( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py index 6018f3a552d..022da243859 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py @@ -104,7 +104,7 @@ def begin_put_non_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 400 to the initial request. :param product: Product to put. @@ -214,7 +214,7 @@ def begin_put_non_retry201_creating400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -325,7 +325,7 @@ def begin_put_non_retry201_creating400_invalid_json( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -435,7 +435,7 @@ def begin_put_async_relative_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -535,7 +535,7 @@ def begin_delete_non_retry400( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 400 with an error body. :keyword callable cls: A custom type or function that will be passed the direct response @@ -623,7 +623,7 @@ def begin_delete202_non_retry400( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 with a location header. :keyword callable cls: A custom type or function that will be passed the direct response @@ -712,7 +712,7 @@ def begin_delete_async_relative_retry400( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -812,7 +812,7 @@ def begin_post_non_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 400 with no error body. :param product: Product to put. @@ -914,7 +914,7 @@ def begin_post202_non_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 with a location header. :param product: Product to put. @@ -1017,7 +1017,7 @@ def begin_post_async_relative_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. @@ -1125,7 +1125,7 @@ def begin_put_error201_no_provisioning_state_payload( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 201 to the initial request with no payload. :param product: Product to put. @@ -1234,7 +1234,7 @@ def begin_put_async_relative_retry_no_status( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -1350,7 +1350,7 @@ def begin_put_async_relative_retry_no_status_payload( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -1447,7 +1447,7 @@ def begin_delete204_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 204 to the initial request, indicating success. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1536,7 +1536,7 @@ def begin_delete_async_relative_retry_no_status( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1636,7 +1636,7 @@ def begin_post202_no_location( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, without a location header. @@ -1740,7 +1740,7 @@ def begin_post_async_relative_retry_no_payload( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. @@ -1846,7 +1846,7 @@ def begin_put200_invalid_json( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -1956,7 +1956,7 @@ def begin_put_async_relative_retry_invalid_header( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -2072,7 +2072,7 @@ def begin_put_async_relative_retry_invalid_json_polling( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """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. @@ -2173,7 +2173,7 @@ def begin_delete202_retry_invalid_header( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. @@ -2263,7 +2263,7 @@ def begin_delete_async_relative_retry_invalid_header( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2353,7 +2353,7 @@ def begin_delete_async_relative_retry_invalid_json_polling( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2453,7 +2453,7 @@ def begin_post202_retry_invalid_header( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -2557,7 +2557,7 @@ def begin_post_async_relative_retry_invalid_header( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. @@ -2662,7 +2662,7 @@ def begin_post_async_relative_retry_invalid_json_polling( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[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. diff --git a/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py b/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py index 86638a4ff27..dd9e42f1111 100644 --- a/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py +++ b/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py @@ -1045,7 +1045,7 @@ def begin_get_multiple_pages_lro( paging_get_multiple_pages_lro_options=None, # type: Optional["models.PagingGetMultiplePagesLroOptions"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.ProductResult"] """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: diff --git a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py index 1b90aa5b9ef..a858f306771 100644 --- a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py +++ b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py @@ -172,7 +172,7 @@ def begin_create( parameters, # type: "models.StorageAccountCreateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.StorageAccount"] """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 diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py index 4485e7eadb0..d2b493f502b 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py @@ -130,7 +130,7 @@ def begin_test_lro( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py index a78c42fb10d..b14ec738268 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py @@ -130,7 +130,7 @@ def begin_test_lro( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py index b6573ec26f5..b474c944d01 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py @@ -130,7 +130,7 @@ def begin_test_lro( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. From a5cc1b683a465d027ee48df194a47d6790751d2e Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 27 May 2020 11:25:18 -0400 Subject: [PATCH 3/4] merging imports across all versions for multiapi mixins --- autorest/codegen/models/imports.py | 18 ++-- .../serializers/metadata_serializer.py | 34 ++++++-- autorest/multiapi/__init__.py | 28 +++++- autorest/multiapi/models/imports.py | 78 +++++++++++++++++ .../multiapi/serializers/import_serializer.py | 87 +++++++++++++++++++ .../{ => serializers}/multiapi_serializer.py | 2 +- .../Multiapi/multiapi/_operations_mixin.py | 4 +- .../multiapi/aio/_operations_mixin_async.py | 4 +- .../Multiapi/multiapi/v1/_metadata.json | 4 +- .../Multiapi/multiapi/v2/_metadata.json | 4 +- .../Multiapi/multiapi/v3/_metadata.json | 4 +- .../multiapinoasync/_operations_mixin.py | 4 +- .../multiapinoasync/v1/_metadata.json | 4 +- .../multiapinoasync/v2/_metadata.json | 4 +- .../multiapinoasync/v3/_metadata.json | 4 +- .../submodule/_operations_mixin.py | 4 +- .../submodule/aio/_operations_mixin_async.py | 4 +- .../submodule/v1/_metadata.json | 4 +- .../submodule/v2/_metadata.json | 4 +- .../submodule/v3/_metadata.json | 4 +- 20 files changed, 259 insertions(+), 44 deletions(-) create mode 100644 autorest/multiapi/models/imports.py create mode 100644 autorest/multiapi/serializers/import_serializer.py rename autorest/multiapi/{ => serializers}/multiapi_serializer.py (99%) diff --git a/autorest/codegen/models/imports.py b/autorest/codegen/models/imports.py index 72a89047566..a12eeaff668 100644 --- a/autorest/codegen/models/imports.py +++ b/autorest/codegen/models/imports.py @@ -7,16 +7,16 @@ from typing import Dict, Optional, Set -class ImportType(Enum): - STDLIB = auto() - THIRDPARTY = auto() - AZURECORE = auto() - LOCAL = auto() +class ImportType(str, Enum): + STDLIB = "stdlib" + THIRDPARTY = "thirdparty" + AZURECORE = "azurecore" + LOCAL = "local" -class TypingSection(Enum): - REGULAR = auto() # this import is always a typing import - CONDITIONAL = auto() # is a typing import when we're dealing with files that py2 will use, else regular - TYPING = auto() # never a typing import +class TypingSection(str, Enum): + REGULAR = "regular" # this import is always a typing import + CONDITIONAL = "conditional" # is a typing import when we're dealing with files that py2 will use, else regular + TYPING = "typing" # never a typing import class FileImport: diff --git a/autorest/codegen/serializers/metadata_serializer.py b/autorest/codegen/serializers/metadata_serializer.py index 64e97aba10d..802ed30baae 100644 --- a/autorest/codegen/serializers/metadata_serializer.py +++ b/autorest/codegen/serializers/metadata_serializer.py @@ -4,6 +4,7 @@ # license information. # -------------------------------------------------------------------------- import copy +import json from typing import List, Optional, Set, Tuple from jinja2 import Environment from ..models import ( @@ -23,6 +24,29 @@ def _correct_credential_parameter(global_parameters: ParameterList, async_mode: ][0] credential_param.schema = CredentialSchema(async_mode=async_mode) +def _json_serialize_imports(imports): + if not imports: + return None + + json_serialize_imports = {} + # need to make name_import set -> list to make the dictionary json serializable + # not using an OrderedDict since we're iterating through a set and the order there varies + # going to sort the list instead + + for typing_section_key, typing_section_value in imports.items(): + json_import_type_dictionary = {} + for import_type_key, import_type_value in typing_section_value.items(): + json_package_name_dictionary = {} + for package_name, name_imports in import_type_value.items(): + name_import_ordered_list = [] + if name_imports: + name_import_ordered_list = list(name_imports) + name_import_ordered_list.sort() + json_package_name_dictionary[package_name] = name_import_ordered_list + json_import_type_dictionary[import_type_key] = json_package_name_dictionary + json_serialize_imports[typing_section_key] = json_import_type_dictionary + return json.dumps(json_serialize_imports) + class MetadataSerializer: def __init__(self, code_model: CodeModel, env: Environment) -> None: @@ -98,12 +122,6 @@ def _is_paging(operation): is_lro=_is_lro, is_paging=_is_paging, str=str, - sync_mixin_imports=( - FileImportSerializer(sync_mixin_imports, is_python_3_file=False) - if sync_mixin_imports else None - ), - async_mixin_imports=( - FileImportSerializer(async_mixin_imports, is_python_3_file=True) - if async_mixin_imports else None - ) + sync_mixin_imports=_json_serialize_imports(sync_mixin_imports.imports), + async_mixin_imports=_json_serialize_imports(async_mixin_imports.imports) ) diff --git a/autorest/multiapi/__init__.py b/autorest/multiapi/__init__.py index 07a7ae64b18..f0250223e36 100644 --- a/autorest/multiapi/__init__.py +++ b/autorest/multiapi/__init__.py @@ -11,7 +11,9 @@ from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple, Optional, cast, Any -from .multiapi_serializer import MultiAPISerializer +from .serializers.multiapi_serializer import MultiAPISerializer +from .serializers.import_serializer import FileImportSerializer +from .models.imports import FileImport from ..jsonrpc import AutorestAPI from .. import Plugin @@ -247,6 +249,18 @@ def _parse_package_name_input(self) -> str: self.output_package_name = self.input_package_name return module_name + def _merge_mixin_imports_across_versions(self, paths_to_versions: List[Path], async_mode: bool): + imports = FileImport() + imports_to_load = "async_imports" if async_mode else "sync_imports" + for version_path in paths_to_versions: + metadata_json = json.loads(self._autorestapi.read_file(version_path / "_metadata.json")) + if not metadata_json.get('operation_mixins'): + continue + current_version_imports = FileImport(json.loads(metadata_json[imports_to_load])) + imports.merge(current_version_imports) + + return imports + def process(self) -> bool: _LOGGER.info("Generating multiapi client") # If True, means the auto-profile will consider preview versions. @@ -324,6 +338,14 @@ def process(self) -> bool: versioned_operations_dict, mixin_operations, last_api_version, preview_mode, async_mode=True ) + sync_imports = self._merge_mixin_imports_across_versions( + paths_to_versions, async_mode=False + ) + + async_imports = self._merge_mixin_imports_across_versions( + paths_to_versions, async_mode=True + ) + conf = { "client_name": metadata_json["client"]["name"], "package_name": self.output_package_name, @@ -340,8 +362,8 @@ def process(self) -> bool: ), "config": metadata_json["config"], "global_parameters": metadata_json["global_parameters"], - "sync_imports": metadata_json["sync_imports"], - "async_imports": metadata_json["async_imports"] + "sync_imports": str(FileImportSerializer(sync_imports, is_python_3_file=False)), + "async_imports": str(FileImportSerializer(async_imports, is_python_3_file=True)) } multiapi_serializer = MultiAPISerializer( diff --git a/autorest/multiapi/models/imports.py b/autorest/multiapi/models/imports.py new file mode 100644 index 00000000000..a12eeaff668 --- /dev/null +++ b/autorest/multiapi/models/imports.py @@ -0,0 +1,78 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from enum import Enum, auto +from typing import Dict, Optional, Set + + +class ImportType(str, Enum): + STDLIB = "stdlib" + THIRDPARTY = "thirdparty" + AZURECORE = "azurecore" + LOCAL = "local" + +class TypingSection(str, Enum): + REGULAR = "regular" # this import is always a typing import + CONDITIONAL = "conditional" # is a typing import when we're dealing with files that py2 will use, else regular + TYPING = "typing" # never a typing import + + +class FileImport: + def __init__( + self, imports: Dict[TypingSection, Dict[ImportType, Dict[str, Set[Optional[str]]]]] = None + ) -> None: + # Basic implementation + # First level dict: TypingSection + # Second level dict: ImportType + # Third level dict: the package name. + # Fourth level set: None if this import is a "import", the name to import if it's a "from" + self._imports: Dict[TypingSection, Dict[ImportType, Dict[str, Set[Optional[str]]]]] = imports or dict() + + def _add_import( + self, + from_section: str, + import_type: ImportType, + name_import: Optional[str] = None, + typing_section: TypingSection = TypingSection.REGULAR + ) -> None: + self._imports.setdefault( + typing_section, dict() + ).setdefault( + import_type, dict() + ).setdefault( + from_section, set() + ).add(name_import) + + def add_from_import( + self, + from_section: str, + name_import: str, + import_type: ImportType, + typing_section: TypingSection = TypingSection.REGULAR + ) -> None: + """Add an import to this import block. + """ + self._add_import(from_section, import_type, name_import, typing_section) + + def add_import( + self, + name_import: str, + import_type: ImportType, + typing_section: TypingSection = TypingSection.REGULAR + ) -> None: + # Implementation detail: a regular import is just a "from" with no from + self._add_import(name_import, import_type, None, typing_section) + + @property + def imports(self) -> Dict[TypingSection, Dict[ImportType, Dict[str, Set[Optional[str]]]]]: + return self._imports + + def merge(self, file_import: "FileImport") -> None: + """Merge the given file import format.""" + for typing_section, import_type_dict in file_import.imports.items(): + for import_type, package_list in import_type_dict.items(): + 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) diff --git a/autorest/multiapi/serializers/import_serializer.py b/autorest/multiapi/serializers/import_serializer.py new file mode 100644 index 00000000000..bf650331e53 --- /dev/null +++ b/autorest/multiapi/serializers/import_serializer.py @@ -0,0 +1,87 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from copy import deepcopy +from typing import Dict, Set, Optional, List +from ..models.imports import ImportType, FileImport, TypingSection + +def _serialize_package(package_name: str, module_list: Set[Optional[str]], delimiter: str) -> str: + buffer = [] + if None in module_list: + buffer.append(f"import {package_name}") + if module_list != {None}: + buffer.append( + "from {} import {}".format( + package_name, ", ".join(sorted([mod for mod in module_list if mod is not None])) + ) + ) + return delimiter.join(buffer) + +def _serialize_type(import_type_dict: Dict[str, Set[Optional[str]]], delimiter: str) -> str: + """Serialize a given import type.""" + import_list = [] + for package_name in sorted(list(import_type_dict.keys())): + module_list = import_type_dict[package_name] + import_list.append(_serialize_package(package_name, module_list, delimiter)) + return delimiter.join(import_list) + +def _get_import_clauses(imports: Dict[ImportType, Dict[str, Set[Optional[str]]]], delimiter: str) -> List[str]: + import_clause = [] + for import_type in ImportType: + if import_type in imports: + import_clause.append(_serialize_type(imports[import_type], delimiter)) + return import_clause + + +class FileImportSerializer: + def __init__(self, file_import: FileImport, is_python_3_file: bool) -> None: + self._file_import = file_import + self.is_python_3_file = is_python_3_file + + def _switch_typing_section_key(self, new_key: TypingSection): + switched_dictionary = {} + switched_dictionary[new_key] = self._file_import.imports[TypingSection.CONDITIONAL] + return switched_dictionary + + def _get_imports_dict(self, baseline_typing_section: TypingSection, add_conditional_typing: bool): + # If this is a python 3 file, our regular imports include the CONDITIONAL category + # If this is not a python 3 file, our typing imports include the CONDITIONAL category + file_import_copy = deepcopy(self._file_import) + if add_conditional_typing and self._file_import.imports.get(TypingSection.CONDITIONAL): + # we switch the TypingSection key for the CONDITIONAL typing imports so we can merge + # the imports together + switched_imports_dictionary = self._switch_typing_section_key(baseline_typing_section) + switched_imports = FileImport(switched_imports_dictionary) + file_import_copy.merge(switched_imports) + return file_import_copy.imports.get(baseline_typing_section, {}) + + def _add_type_checking_import(self): + if ( + self._file_import.imports.get(TypingSection.TYPING) or + (not self.is_python_3_file and self._file_import.imports.get(TypingSection.CONDITIONAL)) + ): + self._file_import.add_from_import("typing", "TYPE_CHECKING", ImportType.STDLIB) + + def __str__(self) -> str: + self._add_type_checking_import() + regular_imports = "" + regular_imports_dict = self._get_imports_dict( + baseline_typing_section=TypingSection.REGULAR, add_conditional_typing=self.is_python_3_file + ) + + if regular_imports_dict: + regular_imports = "\n\n".join( + _get_import_clauses(regular_imports_dict, "\n") + ) + + typing_imports = "" + typing_imports_dict = self._get_imports_dict( + baseline_typing_section=TypingSection.TYPING, add_conditional_typing=not self.is_python_3_file + ) + if typing_imports_dict: + typing_imports += "\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n " + typing_imports += "\n\n ".join(_get_import_clauses(typing_imports_dict, "\n ")) + + return regular_imports + typing_imports diff --git a/autorest/multiapi/multiapi_serializer.py b/autorest/multiapi/serializers/multiapi_serializer.py similarity index 99% rename from autorest/multiapi/multiapi_serializer.py rename to autorest/multiapi/serializers/multiapi_serializer.py index 869677ad7cd..27c53ebfca2 100644 --- a/autorest/multiapi/multiapi_serializer.py +++ b/autorest/multiapi/serializers/multiapi_serializer.py @@ -7,7 +7,7 @@ from pathlib import Path from jinja2 import Environment, PackageLoader -from ..jsonrpc import AutorestAPI +from ...jsonrpc import AutorestAPI class MultiAPISerializer: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py index e53cbcf6409..34857142110 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py @@ -16,10 +16,12 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union class MultiapiServiceClientOperationsMixin(object): diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py index a4af9a328a8..2a9e9278dc6 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py @@ -9,13 +9,15 @@ # regenerated. # -------------------------------------------------------------------------- from msrest import Serializer, Deserializer -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling class MultiapiServiceClientOperationsMixin(object): diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json index 0082bc1ecd8..86f3abb7a30 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json @@ -69,6 +69,6 @@ "call": "product" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\nfrom azure.core.polling import LROPoller, NoPolling, PollingMethod\nfrom azure.core.polling.base_polling import LROBasePolling\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest\nfrom azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod\nfrom azure.core.polling.async_base_polling import AsyncLROBasePolling" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.polling\": [\"LROPoller\", \"NoPolling\", \"PollingMethod\"], \"azure.core.polling.base_polling\": [\"LROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.polling\": [\"AsyncLROPoller\", \"AsyncNoPolling\", \"AsyncPollingMethod\"], \"azure.core.polling.async_base_polling\": [\"AsyncLROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json index bcfd8aaf876..7cdd0320de7 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json @@ -48,6 +48,6 @@ "call": "id, message" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json index 5953fe8f741..11d13eaf335 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json @@ -48,6 +48,6 @@ "call": "" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.paging import ItemPaged\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar", - "async_imports": "from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.async_paging import AsyncItemPaged, AsyncList\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py index 389fa6cc5a1..a0197a7ff1a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py @@ -16,10 +16,12 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union class MultiapiServiceClientOperationsMixin(object): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json index b47ebb898b9..efd0e307ad3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json @@ -69,6 +69,6 @@ "call": "product" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\nfrom azure.core.polling import LROPoller, NoPolling, PollingMethod\nfrom azure.core.polling.base_polling import LROBasePolling\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest\nfrom azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod\nfrom azure.core.polling.async_base_polling import AsyncLROBasePolling" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.polling\": [\"LROPoller\", \"NoPolling\", \"PollingMethod\"], \"azure.core.polling.base_polling\": [\"LROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.polling\": [\"AsyncLROPoller\", \"AsyncNoPolling\", \"AsyncPollingMethod\"], \"azure.core.polling.async_base_polling\": [\"AsyncLROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json index 0323f54a015..91a96cac25e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json @@ -48,6 +48,6 @@ "call": "id, message" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json index 40e1a20d0fa..5f89c882881 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json @@ -48,6 +48,6 @@ "call": "" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.paging import ItemPaged\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar", - "async_imports": "from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.async_paging import AsyncItemPaged, AsyncList\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py index 07febfed3c6..1a6fb890ee0 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py @@ -16,10 +16,12 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union class MultiapiServiceClientOperationsMixin(object): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py index b8844971c34..fd8d44748f0 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py @@ -9,13 +9,15 @@ # regenerated. # -------------------------------------------------------------------------- from msrest import Serializer, Deserializer -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling class MultiapiServiceClientOperationsMixin(object): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json index bb1d74396e0..972cfaee6e9 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json @@ -69,6 +69,6 @@ "call": "product" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\nfrom azure.core.polling import LROPoller, NoPolling, PollingMethod\nfrom azure.core.polling.base_polling import LROBasePolling\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest\nfrom azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod\nfrom azure.core.polling.async_base_polling import AsyncLROBasePolling" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.polling\": [\"LROPoller\", \"NoPolling\", \"PollingMethod\"], \"azure.core.polling.base_polling\": [\"LROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.polling\": [\"AsyncLROPoller\", \"AsyncNoPolling\", \"AsyncPollingMethod\"], \"azure.core.polling.async_base_polling\": [\"AsyncLROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json index 0450cf993d7..028534fcf94 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json @@ -48,6 +48,6 @@ "call": "id, message" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json index bee6b022a45..dc8d442255d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json @@ -48,6 +48,6 @@ "call": "" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.paging import ItemPaged\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar", - "async_imports": "from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.async_paging import AsyncItemPaged, AsyncList\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file From 03c17b0256e84a25c51031b94f2e61025f9bb495 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 27 May 2020 11:44:42 -0400 Subject: [PATCH 4/4] fixed pylint and mypy --- autorest/codegen/models/__init__.py | 3 ++- autorest/codegen/models/imports.py | 2 +- .../serializers/metadata_serializer.py | 21 +++++++++++++------ autorest/multiapi/__init__.py | 9 ++++---- autorest/multiapi/models/__init__.py | 13 ++++++++++++ autorest/multiapi/models/imports.py | 2 +- autorest/multiapi/serializers/__init__.py | 13 ++++++++++++ .../multiapi/serializers/import_serializer.py | 2 +- 8 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 autorest/multiapi/models/__init__.py create mode 100644 autorest/multiapi/serializers/__init__.py diff --git a/autorest/codegen/models/__init__.py b/autorest/codegen/models/__init__.py index 8b68c5654c2..c52dd8f40b4 100644 --- a/autorest/codegen/models/__init__.py +++ b/autorest/codegen/models/__init__.py @@ -13,7 +13,7 @@ from .enum_schema import EnumSchema from .base_schema import BaseSchema from .constant_schema import ConstantSchema -from .imports import FileImport, ImportType +from .imports import FileImport, ImportType, TypingSection from .lro_operation import LROOperation from .paging_operation import PagingOperation from .parameter import Parameter @@ -36,6 +36,7 @@ "EnumSchema", "FileImport", "ImportType", + "TypingSection", "PrimitiveSchema", "LROOperation", "Operation", diff --git a/autorest/codegen/models/imports.py b/autorest/codegen/models/imports.py index a12eeaff668..f855e053018 100644 --- a/autorest/codegen/models/imports.py +++ b/autorest/codegen/models/imports.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from enum import Enum, auto +from enum import Enum from typing import Dict, Optional, Set diff --git a/autorest/codegen/serializers/metadata_serializer.py b/autorest/codegen/serializers/metadata_serializer.py index 802ed30baae..2ec39660c03 100644 --- a/autorest/codegen/serializers/metadata_serializer.py +++ b/autorest/codegen/serializers/metadata_serializer.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- import copy import json -from typing import List, Optional, Set, Tuple +from typing import List, Optional, Set, Tuple, Dict from jinja2 import Environment from ..models import ( CodeModel, @@ -14,9 +14,10 @@ LROOperation, PagingOperation, CredentialSchema, - ParameterList + ParameterList, + TypingSection, + ImportType ) -from .import_serializer import FileImportSerializer def _correct_credential_parameter(global_parameters: ParameterList, async_mode: bool) -> None: credential_param = [ @@ -24,7 +25,9 @@ def _correct_credential_parameter(global_parameters: ParameterList, async_mode: ][0] credential_param.schema = CredentialSchema(async_mode=async_mode) -def _json_serialize_imports(imports): +def _json_serialize_imports( + imports: Dict[TypingSection, Dict[ImportType, Dict[str, Set[Optional[str]]]]] +): if not imports: return None @@ -122,6 +125,12 @@ def _is_paging(operation): is_lro=_is_lro, is_paging=_is_paging, str=str, - sync_mixin_imports=_json_serialize_imports(sync_mixin_imports.imports), - async_mixin_imports=_json_serialize_imports(async_mixin_imports.imports) + sync_mixin_imports=( + _json_serialize_imports(sync_mixin_imports.imports) + if sync_mixin_imports else None + ), + async_mixin_imports=( + _json_serialize_imports(async_mixin_imports.imports) + if async_mixin_imports else None + ) ) diff --git a/autorest/multiapi/__init__.py b/autorest/multiapi/__init__.py index f0250223e36..4eb279f1a79 100644 --- a/autorest/multiapi/__init__.py +++ b/autorest/multiapi/__init__.py @@ -11,9 +11,8 @@ from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple, Optional, cast, Any -from .serializers.multiapi_serializer import MultiAPISerializer -from .serializers.import_serializer import FileImportSerializer -from .models.imports import FileImport +from .serializers import MultiAPISerializer, FileImportSerializer +from .models import FileImport from ..jsonrpc import AutorestAPI from .. import Plugin @@ -249,7 +248,9 @@ def _parse_package_name_input(self) -> str: self.output_package_name = self.input_package_name return module_name - def _merge_mixin_imports_across_versions(self, paths_to_versions: List[Path], async_mode: bool): + def _merge_mixin_imports_across_versions( + self, paths_to_versions: List[Path], async_mode: bool + ) -> FileImport: imports = FileImport() imports_to_load = "async_imports" if async_mode else "sync_imports" for version_path in paths_to_versions: diff --git a/autorest/multiapi/models/__init__.py b/autorest/multiapi/models/__init__.py new file mode 100644 index 00000000000..5ac7539c8bc --- /dev/null +++ b/autorest/multiapi/models/__init__.py @@ -0,0 +1,13 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from .imports import ImportType, FileImport, TypingSection + +__all__ = [ + "ImportType", + "FileImport", + "TypingSection" +] diff --git a/autorest/multiapi/models/imports.py b/autorest/multiapi/models/imports.py index a12eeaff668..f855e053018 100644 --- a/autorest/multiapi/models/imports.py +++ b/autorest/multiapi/models/imports.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from enum import Enum, auto +from enum import Enum from typing import Dict, Optional, Set diff --git a/autorest/multiapi/serializers/__init__.py b/autorest/multiapi/serializers/__init__.py new file mode 100644 index 00000000000..92bfc4a46f0 --- /dev/null +++ b/autorest/multiapi/serializers/__init__.py @@ -0,0 +1,13 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from .import_serializer import FileImportSerializer +from .multiapi_serializer import MultiAPISerializer + +__all__ = [ + "FileImportSerializer", + "MultiAPISerializer" +] diff --git a/autorest/multiapi/serializers/import_serializer.py b/autorest/multiapi/serializers/import_serializer.py index bf650331e53..e597a3b9116 100644 --- a/autorest/multiapi/serializers/import_serializer.py +++ b/autorest/multiapi/serializers/import_serializer.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy from typing import Dict, Set, Optional, List -from ..models.imports import ImportType, FileImport, TypingSection +from ..models import ImportType, FileImport, TypingSection def _serialize_package(package_name: str, module_list: Set[Optional[str]], delimiter: str) -> str: buffer = []