From 0fd3960de38e1c42d00a2127f20c8ddcf6798442 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Jun 2021 16:15:43 -0700 Subject: [PATCH 1/6] DocumentStatusResult -> DocumentStatus --- .../azure/ai/translation/document/__init__.py | 4 +-- .../azure/ai/translation/document/_client.py | 26 +++++++++---------- .../azure/ai/translation/document/_models.py | 4 +-- .../azure/ai/translation/document/_polling.py | 2 +- .../document/aio/_async_polling.py | 2 +- .../translation/document/aio/_client_async.py | 26 +++++++++---------- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/__init__.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/__init__.py index d931ef8091eb..3eeba19e86a0 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/__init__.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/__init__.py @@ -14,7 +14,7 @@ from ._models import ( TranslationTarget, TranslationStatusResult, - DocumentStatusResult, + DocumentStatus, DocumentTranslationError, TranslationGlossary, DocumentTranslationInput, @@ -33,7 +33,7 @@ "FileFormat", "TranslationTarget", "TranslationStatusResult", - "DocumentStatusResult", + "DocumentStatus", "DocumentTranslationError", "DocumentTranslationLROPoller", ] diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py index fb764d690e1a..cf44cc8bfb59 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py @@ -12,7 +12,7 @@ ) from ._models import ( TranslationStatusResult, - DocumentStatusResult, + DocumentStatus, DocumentTranslationInput, FileFormat, ) @@ -100,12 +100,12 @@ def close(self): @overload def begin_translation(self, source_url, target_url, target_language_code, **kwargs): - # type: (str, str, str, **Any) -> DocumentTranslationLROPoller[ItemPaged[DocumentStatusResult]] + # type: (str, str, str, **Any) -> DocumentTranslationLROPoller[ItemPaged[DocumentStatus]] pass @overload def begin_translation(self, inputs, **kwargs): - # type: (List[DocumentTranslationInput], **Any) -> DocumentTranslationLROPoller[ItemPaged[DocumentStatusResult]] + # type: (List[DocumentTranslationInput], **Any) -> DocumentTranslationLROPoller[ItemPaged[DocumentStatus]] pass def begin_translation( @@ -132,9 +132,9 @@ def begin_translation( for the destination to write translated documents. :type inputs: List[~azure.ai.translation.document.DocumentTranslationInput] :return: An instance of a DocumentTranslationLROPoller. Call `result()` on the poller - object to return a pageable of DocumentStatusResult. A DocumentStatusResult will be + object to return a pageable of DocumentStatus. A DocumentStatus will be returned for each translation on a document. - :rtype: DocumentTranslationLROPoller[ItemPaged[~azure.ai.translation.document.DocumentStatusResult]] + :rtype: DocumentTranslationLROPoller[ItemPaged[~azure.ai.translation.document.DocumentStatus]] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -284,7 +284,7 @@ def _convert_from_generated_model( @distributed_trace def list_all_document_statuses(self, translation_id, **kwargs): - # type: (str, **Any) -> ItemPaged[DocumentStatusResult] + # type: (str, **Any) -> ItemPaged[DocumentStatus] """List all the document statuses for a given translation operation. :param str translation_id: ID of translation operation to list documents for. @@ -301,8 +301,8 @@ def list_all_document_statuses(self, translation_id, **kwargs): :keyword list[str] order_by: the sorting query for the documents. format: ["parm1 asc/desc", "parm2 asc/desc", ...] (ex: 'createdDateTimeUtc asc', 'createdDateTimeUtc desc'). - :return: A pageable of DocumentStatusResult. - :rtype: ~azure.core.paging.ItemPaged[DocumentStatusResult] + :return: A pageable of DocumentStatus. + :rtype: ~azure.core.paging.ItemPaged[DocumentStatus] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -326,7 +326,7 @@ def list_all_document_statuses(self, translation_id, **kwargs): document_ids = kwargs.pop("document_ids", None) def _convert_from_generated_model(generated_model): - return DocumentStatusResult._from_generated( # pylint: disable=protected-access + return DocumentStatus._from_generated( # pylint: disable=protected-access generated_model ) @@ -349,20 +349,20 @@ def _convert_from_generated_model(generated_model): @distributed_trace def get_document_status(self, translation_id, document_id, **kwargs): - # type: (str, str, **Any) -> DocumentStatusResult + # type: (str, str, **Any) -> DocumentStatus """Get the status of an individual document within a translation operation. :param str translation_id: The translation operation ID. :param str document_id: The ID for the document. - :return: A DocumentStatusResult with information on the status of the document. - :rtype: ~azure.ai.translation.document.DocumentStatusResult + :return: A DocumentStatus with information on the status of the document. + :rtype: ~azure.ai.translation.document.DocumentStatus :raises ~azure.core.exceptions.HttpResponseError or ~azure.core.exceptions.ResourceNotFoundError: """ document_status = self._client.document_translation.get_document_status( translation_id, document_id, **kwargs ) - return DocumentStatusResult._from_generated( # pylint: disable=protected-access + return DocumentStatus._from_generated( # pylint: disable=protected-access document_status ) diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py index b23d601630ab..86ced35bf172 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py @@ -328,7 +328,7 @@ def __repr__(self): ) -class DocumentStatusResult( +class DocumentStatus( object ): # pylint: disable=useless-object-inheritance, R0903, R0902 """Status information about a particular document within a translation operation. @@ -393,7 +393,7 @@ def _from_generated(cls, doc_status): def __repr__(self): # pylint: disable=line-too-long return ( - "DocumentStatusResult(id={}, source_document_url={}, " + "DocumentStatus(id={}, source_document_url={}, " "translated_document_url={}, created_on={}, last_updated_on={}, " "status={}, translated_to={}, error={}, translation_progress={}, " "characters_charged={})".format( diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py index 99f8d1e9bd79..5517d8e28e72 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py @@ -39,7 +39,7 @@ class DocumentTranslationLROPoller(LROPoller): """A custom poller implementation for Document Translation. Call `result()` on the poller to return - a pageable of :class:`~azure.ai.translation.document.DocumentStatusResult`.""" + a pageable of :class:`~azure.ai.translation.document.DocumentStatus`.""" @property def id(self): diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py index 900b4f5a5c2c..435d9b1ea30e 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py @@ -21,7 +21,7 @@ class AsyncDocumentTranslationLROPoller(AsyncLROPoller[PollingReturnType]): """An async custom poller implementation for Document Translation. Call `result()` on the poller to return - a pageable of :class:`~azure.ai.translation.document.DocumentStatusResult`.""" + a pageable of :class:`~azure.ai.translation.document.DocumentStatus`.""" @property def id(self) -> str: diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py index 0bcf479c60d6..fd1b8a7b4d2d 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py @@ -17,7 +17,7 @@ TranslationStatusResult, DocumentTranslationInput, FileFormat, - DocumentStatusResult, + DocumentStatus, ) from .._helpers import ( get_http_logging_policy, @@ -107,13 +107,13 @@ async def close(self) -> None: @overload async def begin_translation( self, source_url: str, target_url: str, target_language_code: str, **kwargs: Any - ) -> AsyncDocumentTranslationLROPoller[AsyncItemPaged[DocumentStatusResult]]: + ) -> AsyncDocumentTranslationLROPoller[AsyncItemPaged[DocumentStatus]]: ... @overload async def begin_translation( self, inputs: List[DocumentTranslationInput], **kwargs: Any - ) -> AsyncDocumentTranslationLROPoller[AsyncItemPaged[DocumentStatusResult]]: + ) -> AsyncDocumentTranslationLROPoller[AsyncItemPaged[DocumentStatus]]: ... @distributed_trace_async @@ -141,9 +141,9 @@ async def begin_translation( for the destination to write translated documents. :type inputs: List[~azure.ai.translation.document.DocumentTranslationInput] :return: An instance of an AsyncDocumentTranslationLROPoller. Call `result()` on the poller - object to return a pageable of DocumentStatusResult. A DocumentStatusResult will be + object to return a pageable of DocumentStatus. A DocumentStatus will be returned for each translation on a document. - :rtype: AsyncDocumentTranslationLROPoller[AsyncItemPaged[~azure.ai.translation.document.DocumentStatusResult]] + :rtype: AsyncDocumentTranslationLROPoller[AsyncItemPaged[~azure.ai.translation.document.DocumentStatus]] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -294,7 +294,7 @@ def _convert_from_generated_model(generated_model): @distributed_trace def list_all_document_statuses(self, translation_id, **kwargs): - # type: (str, **Any) -> AsyncItemPaged[DocumentStatusResult] + # type: (str, **Any) -> AsyncItemPaged[DocumentStatus] """List all the document statuses for a given translation operation. :param str translation_id: ID of translation operation to list documents for. @@ -311,8 +311,8 @@ def list_all_document_statuses(self, translation_id, **kwargs): :keyword list[str] order_by: the sorting query for the documents. format: ["parm1 asc/desc", "parm2 asc/desc", ...] (ex: 'createdDateTimeUtc asc', 'createdDateTimeUtc desc'). - :return: A pageable of DocumentStatusResult. - :rtype: ~azure.core.paging.ItemPaged[DocumentStatusResult] + :return: A pageable of DocumentStatus. + :rtype: ~azure.core.paging.ItemPaged[DocumentStatus] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -337,7 +337,7 @@ def list_all_document_statuses(self, translation_id, **kwargs): def _convert_from_generated_model(generated_model): # pylint: disable=protected-access - return DocumentStatusResult._from_generated(generated_model) + return DocumentStatus._from_generated(generated_model) model_conversion_function = kwargs.pop( "cls", @@ -358,20 +358,20 @@ def _convert_from_generated_model(generated_model): @distributed_trace_async async def get_document_status(self, translation_id, document_id, **kwargs): - # type: (str, str, **Any) -> DocumentStatusResult + # type: (str, str, **Any) -> DocumentStatus """Get the status of an individual document within a translation operation. :param str translation_id: The translation operation ID. :param str document_id: The ID for the document. - :return: A DocumentStatusResult with information on the status of the document. - :rtype: ~azure.ai.translation.document.DocumentStatusResult + :return: A DocumentStatus with information on the status of the document. + :rtype: ~azure.ai.translation.document.DocumentStatus :raises ~azure.core.exceptions.HttpResponseError or ~azure.core.exceptions.ResourceNotFoundError: """ document_status = await self._client.document_translation.get_document_status( translation_id, document_id, **kwargs ) # pylint: disable=protected-access - return DocumentStatusResult._from_generated(document_status) + return DocumentStatus._from_generated(document_status) @distributed_trace_async async def get_glossary_formats(self, **kwargs): From ca438e9cb166daf4a42a518b3144c874082f0caf Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Jun 2021 16:29:01 -0700 Subject: [PATCH 2/6] TranslationStatusResult -> TranslationStatus --- .../azure-ai-translation-document/README.md | 2 +- .../azure/ai/translation/document/__init__.py | 4 ++-- .../azure/ai/translation/document/_client.py | 18 +++++++++--------- .../azure/ai/translation/document/_models.py | 4 ++-- .../azure/ai/translation/document/_polling.py | 8 ++++---- .../translation/document/aio/_async_polling.py | 8 ++++---- .../translation/document/aio/_client_async.py | 18 +++++++++--------- .../sample_list_all_translations_async.py | 2 +- .../samples/sample_list_all_translations.py | 2 +- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/sdk/translation/azure-ai-translation-document/README.md b/sdk/translation/azure-ai-translation-document/README.md index 5fcc444b4a68..7c1351874858 100644 --- a/sdk/translation/azure-ai-translation-document/README.md +++ b/sdk/translation/azure-ai-translation-document/README.md @@ -303,7 +303,7 @@ credential = AzureKeyCredential("") document_translation_client = DocumentTranslationClient(endpoint, credential) -operations = document_translation_client.list_all_translation_statuses() # type: ItemPaged[TranslationStatusResult] +operations = document_translation_client.list_all_translation_statuses() # type: ItemPaged[TranslationStatus] for operation in operations: print("\nID: {}".format(operation.id)) diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/__init__.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/__init__.py index 3eeba19e86a0..5baaff7595f5 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/__init__.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/__init__.py @@ -13,7 +13,7 @@ from ._polling import DocumentTranslationLROPoller from ._models import ( TranslationTarget, - TranslationStatusResult, + TranslationStatus, DocumentStatus, DocumentTranslationError, TranslationGlossary, @@ -32,7 +32,7 @@ "StorageInputType", "FileFormat", "TranslationTarget", - "TranslationStatusResult", + "TranslationStatus", "DocumentStatus", "DocumentTranslationError", "DocumentTranslationLROPoller", diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py index cf44cc8bfb59..544d7c131728 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py @@ -11,7 +11,7 @@ BatchDocumentTranslationClient as _BatchDocumentTranslationClient, ) from ._models import ( - TranslationStatusResult, + TranslationStatus, DocumentStatus, DocumentTranslationInput, FileFormat, @@ -185,22 +185,22 @@ def deserialization_callback( @distributed_trace def get_translation_status(self, translation_id, **kwargs): - # type: (str, **Any) -> TranslationStatusResult + # type: (str, **Any) -> TranslationStatus """Gets the status of the translation operation. Includes the overall status, as well as a summary of the documents that are being translated as part of that translation operation. :param str translation_id: The translation operation ID. - :return: A TranslationStatusResult with information on the status of the translation operation. - :rtype: ~azure.ai.translation.document.TranslationStatusResult + :return: A TranslationStatus with information on the status of the translation operation. + :rtype: ~azure.ai.translation.document.TranslationStatus :raises ~azure.core.exceptions.HttpResponseError or ~azure.core.exceptions.ResourceNotFoundError: """ translation_status = self._client.document_translation.get_translation_status( translation_id, **kwargs ) - return TranslationStatusResult._from_generated( # pylint: disable=protected-access + return TranslationStatus._from_generated( # pylint: disable=protected-access translation_status ) @@ -223,7 +223,7 @@ def cancel_translation(self, translation_id, **kwargs): @distributed_trace def list_all_translation_statuses(self, **kwargs): - # type: (**Any) -> ItemPaged[TranslationStatusResult] + # type: (**Any) -> ItemPaged[TranslationStatus] """List all the submitted translation operations under the Document Translation resource. :keyword int top: the total number of operations to return (across all pages) from all submitted translations. @@ -239,8 +239,8 @@ def list_all_translation_statuses(self, **kwargs): :keyword list[str] order_by: the sorting query for the operations returned. format: ["parm1 asc/desc", "parm2 asc/desc", ...] (ex: 'createdDateTimeUtc asc', 'createdDateTimeUtc desc'). - :return: A pageable of TranslationStatusResult. - :rtype: ~azure.core.paging.ItemPaged[TranslationStatusResult] + :return: A pageable of TranslationStatus. + :rtype: ~azure.core.paging.ItemPaged[TranslationStatus] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -262,7 +262,7 @@ def list_all_translation_statuses(self, **kwargs): def _convert_from_generated_model( generated_model, ): # pylint: disable=protected-access - return TranslationStatusResult._from_generated( + return TranslationStatus._from_generated( generated_model ) # pylint: disable=protected-access diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py index 86ced35bf172..41516f84743f 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py @@ -231,7 +231,7 @@ def __repr__(self): ) -class TranslationStatusResult( +class TranslationStatus( object ): # pylint: disable=useless-object-inheritance, too-many-instance-attributes """Status information about the translation operation. @@ -307,7 +307,7 @@ def _from_generated(cls, batch_status_details): def __repr__(self): return ( - "TranslationStatusResult(id={}, created_on={}, " + "TranslationStatus(id={}, created_on={}, " "last_updated_on={}, status={}, error={}, documents_total_count={}, " "documents_failed_count={}, documents_succeeded_count={}, " "documents_in_progress_count={}, documents_not_yet_started_count={}, " diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py index 5517d8e28e72..bb97aacc92fb 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py @@ -18,7 +18,7 @@ from azure.core.exceptions import HttpResponseError, ODataV4Format from ._generated.models import TranslationStatus -from ._models import TranslationStatusResult +from ._models import TranslationStatus if TYPE_CHECKING: @@ -58,12 +58,12 @@ def id(self): @property def details(self): - # type: () -> TranslationStatusResult + # type: () -> TranslationStatus """The details for the translation operation - :rtype: ~azure.ai.translation.document.TranslationStatusResult + :rtype: ~azure.ai.translation.document.TranslationStatus """ - return TranslationStatusResult._from_generated( # pylint: disable=protected-access + return TranslationStatus._from_generated( # pylint: disable=protected-access self._polling_method._current_body # pylint: disable=protected-access ) diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py index 435d9b1ea30e..74cd1f27a13a 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py @@ -12,7 +12,7 @@ ) from azure.core.polling.async_base_polling import AsyncLROBasePolling from .._generated.models import TranslationStatus -from .._models import TranslationStatusResult +from .._models import TranslationStatus PollingReturnType = TypeVar("PollingReturnType") _FINISHED = frozenset(["succeeded", "cancelled", "cancelling", "failed"]) @@ -38,12 +38,12 @@ def id(self) -> str: ) @property - def details(self) -> TranslationStatusResult: + def details(self) -> TranslationStatus: """The details for the translation operation - :rtype: ~azure.ai.translation.document.TranslationStatusResult + :rtype: ~azure.ai.translation.document.TranslationStatus """ - return TranslationStatusResult._from_generated( # pylint: disable=protected-access + return TranslationStatus._from_generated( # pylint: disable=protected-access self._polling_method._current_body # pylint: disable=protected-access ) diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py index fd1b8a7b4d2d..7ee5b04a8530 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py @@ -14,7 +14,7 @@ ) from .._user_agent import USER_AGENT from .._models import ( - TranslationStatusResult, + TranslationStatus, DocumentTranslationInput, FileFormat, DocumentStatus, @@ -194,15 +194,15 @@ def deserialization_callback( @distributed_trace_async async def get_translation_status(self, translation_id, **kwargs): - # type: (str, **Any) -> TranslationStatusResult + # type: (str, **Any) -> TranslationStatus """Gets the status of the translation operation. Includes the overall status, as well as a summary of the documents that are being translated as part of that translation operation. :param str translation_id: The translation operation ID. - :return: A TranslationStatusResult with information on the status of the translation operation. - :rtype: ~azure.ai.translation.document.TranslationStatusResult + :return: A TranslationStatus with information on the status of the translation operation. + :rtype: ~azure.ai.translation.document.TranslationStatus :raises ~azure.core.exceptions.HttpResponseError or ~azure.core.exceptions.ResourceNotFoundError: """ @@ -212,7 +212,7 @@ async def get_translation_status(self, translation_id, **kwargs): ) ) # pylint: disable=protected-access - return TranslationStatusResult._from_generated(translation_status) + return TranslationStatus._from_generated(translation_status) @distributed_trace_async async def cancel_translation(self, translation_id, **kwargs): @@ -235,7 +235,7 @@ async def cancel_translation(self, translation_id, **kwargs): @distributed_trace def list_all_translation_statuses(self, **kwargs): - # type: (**Any) -> AsyncItemPaged[TranslationStatusResult] + # type: (**Any) -> AsyncItemPaged[TranslationStatus] """List all the submitted translation operations under the Document Translation resource. :keyword int top: the total number of operations to return (across all pages) from all submitted translations. @@ -251,8 +251,8 @@ def list_all_translation_statuses(self, **kwargs): :keyword list[str] order_by: the sorting query for the operations returned. format: ["parm1 asc/desc", "parm2 asc/desc", ...] (ex: 'createdDateTimeUtc asc', 'createdDateTimeUtc desc'). - :return: A pageable of TranslationStatusResult. - :rtype: ~azure.core.paging.ItemPaged[TranslationStatusResult] + :return: A pageable of TranslationStatus. + :rtype: ~azure.core.paging.ItemPaged[TranslationStatus] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -274,7 +274,7 @@ def list_all_translation_statuses(self, **kwargs): def _convert_from_generated_model(generated_model): # pylint: disable=protected-access - return TranslationStatusResult._from_generated(generated_model) + return TranslationStatus._from_generated(generated_model) model_conversion_function = kwargs.pop( "cls", diff --git a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_all_translations_async.py b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_all_translations_async.py index dcacbe670d5d..e00d34c61771 100644 --- a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_all_translations_async.py +++ b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_all_translations_async.py @@ -35,7 +35,7 @@ async def sample_list_all_translations_async(): client = DocumentTranslationClient(endpoint, AzureKeyCredential(key)) async with client: - operations = client.list_all_translation_statuses() # type: AsyncItemPaged[TranslationStatusResult] + operations = client.list_all_translation_statuses() # type: AsyncItemPaged[TranslationStatus] async for operation in operations: print("ID: {}".format(operation.id)) diff --git a/sdk/translation/azure-ai-translation-document/samples/sample_list_all_translations.py b/sdk/translation/azure-ai-translation-document/samples/sample_list_all_translations.py index 8ea90201f717..ac96fa6be557 100644 --- a/sdk/translation/azure-ai-translation-document/samples/sample_list_all_translations.py +++ b/sdk/translation/azure-ai-translation-document/samples/sample_list_all_translations.py @@ -33,7 +33,7 @@ def sample_list_all_translations(): key = os.environ["AZURE_DOCUMENT_TRANSLATION_KEY"] client = DocumentTranslationClient(endpoint, AzureKeyCredential(key)) - operations = client.list_all_translation_statuses() # type: ItemPaged[TranslationStatusResult] + operations = client.list_all_translation_statuses() # type: ItemPaged[TranslationStatus] for operation in operations: print("ID: {}".format(operation.id)) From b861068e3e23f46121c941369506b86ba19e13b9 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Jun 2021 16:30:14 -0700 Subject: [PATCH 3/6] get_document_formats -> get_supported_document_formats --- .../azure/ai/translation/document/_client.py | 2 +- .../azure/ai/translation/document/aio/_client_async.py | 2 +- .../samples/async_samples/sample_authentication_async.py | 4 ++-- .../samples/sample_authentication.py | 4 ++-- .../tests/test_supported_formats.py | 2 +- .../tests/test_supported_formats_async.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py index 544d7c131728..f7b59544ca63 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py @@ -384,7 +384,7 @@ def get_glossary_formats(self, **kwargs): ) @distributed_trace - def get_document_formats(self, **kwargs): + def get_supported_document_formats(self, **kwargs): # type: (**Any) -> List[FileFormat] """Get the list of the document formats supported by the Document Translation service. diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py index 7ee5b04a8530..4a461a8827d4 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py @@ -391,7 +391,7 @@ async def get_glossary_formats(self, **kwargs): return FileFormat._from_generated_list(glossary_formats.value) @distributed_trace_async - async def get_document_formats(self, **kwargs): + async def get_supported_document_formats(self, **kwargs): # type: (**Any) -> List[FileFormat] """Get the list of the document formats supported by the Document Translation service. diff --git a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py index b516ba16ea8d..d2131851b652 100644 --- a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py +++ b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py @@ -50,7 +50,7 @@ async def sample_authentication_api_key_async(): # make calls with authenticated client async with document_translation_client: - result = await document_translation_client.get_document_formats() + result = await document_translation_client.get_supported_document_formats() async def sample_authentication_with_azure_active_directory_async(): @@ -69,7 +69,7 @@ async def sample_authentication_with_azure_active_directory_async(): # make calls with authenticated client async with document_translation_client: - result = await document_translation_client.get_document_formats() + result = await document_translation_client.get_supported_document_formats() async def main(): diff --git a/sdk/translation/azure-ai-translation-document/samples/sample_authentication.py b/sdk/translation/azure-ai-translation-document/samples/sample_authentication.py index e66e891b6358..7cf4073740d5 100644 --- a/sdk/translation/azure-ai-translation-document/samples/sample_authentication.py +++ b/sdk/translation/azure-ai-translation-document/samples/sample_authentication.py @@ -48,7 +48,7 @@ def sample_authentication_api_key(): # [END create_dt_client_with_key] # make calls with authenticated client - result = document_translation_client.get_document_formats() + result = document_translation_client.get_supported_document_formats() def sample_authentication_with_azure_active_directory(): @@ -66,7 +66,7 @@ def sample_authentication_with_azure_active_directory(): # [END create_dt_client_with_aad] # make calls with authenticated client - result = document_translation_client.get_document_formats() + result = document_translation_client.get_supported_document_formats() if __name__ == '__main__': diff --git a/sdk/translation/azure-ai-translation-document/tests/test_supported_formats.py b/sdk/translation/azure-ai-translation-document/tests/test_supported_formats.py index 84139227be90..e27f3ce7a32a 100644 --- a/sdk/translation/azure-ai-translation-document/tests/test_supported_formats.py +++ b/sdk/translation/azure-ai-translation-document/tests/test_supported_formats.py @@ -17,7 +17,7 @@ class TestSupportedFormats(DocumentTranslationTest): @DocumentTranslationClientPreparer() def test_supported_document_formats(self, client): # get supported formats - supported_doc_formats = client.get_document_formats() + supported_doc_formats = client.get_supported_document_formats() self.assertIsNotNone(supported_doc_formats) # validate for doc_format in supported_doc_formats: diff --git a/sdk/translation/azure-ai-translation-document/tests/test_supported_formats_async.py b/sdk/translation/azure-ai-translation-document/tests/test_supported_formats_async.py index f68ec4c17ab0..6d0f0507cdd1 100644 --- a/sdk/translation/azure-ai-translation-document/tests/test_supported_formats_async.py +++ b/sdk/translation/azure-ai-translation-document/tests/test_supported_formats_async.py @@ -17,7 +17,7 @@ class TestSupportedFormats(AsyncDocumentTranslationTest): @DocumentTranslationClientPreparer() async def test_supported_document_formats(self, client): # get supported formats - supported_doc_formats = await client.get_document_formats() + supported_doc_formats = await client.get_supported_document_formats() self.assertIsNotNone(supported_doc_formats) # validate for doc_format in supported_doc_formats: From 3f2d375f2b455c062afdf92ecd8c7c8918ea2687 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Jun 2021 16:31:19 -0700 Subject: [PATCH 4/6] get_glossary_formats -> get_supported_glossary_formats --- .../azure/ai/translation/document/_client.py | 2 +- .../azure/ai/translation/document/_models.py | 8 ++++---- .../azure/ai/translation/document/aio/_client_async.py | 2 +- .../tests/test_supported_formats.py | 2 +- .../tests/test_supported_formats_async.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py index f7b59544ca63..78af24940f56 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py @@ -367,7 +367,7 @@ def get_document_status(self, translation_id, document_id, **kwargs): ) @distributed_trace - def get_glossary_formats(self, **kwargs): + def get_supported_glossary_formats(self, **kwargs): # type: (**Any) -> List[FileFormat] """Get the list of the glossary formats supported by the Document Translation service. diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py index 41516f84743f..301c915e920c 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py @@ -22,10 +22,10 @@ class TranslationGlossary(object): # pylint: disable=useless-object-inheritance the glossary file in the storage blob container. If the translation language pair is not present in the glossary, it will not be applied. :param str file_format: Required. Format of the glossary file. To see supported formats, - call the :func:`~DocumentTranslationClient.get_glossary_formats()` client method. + call the :func:`~DocumentTranslationClient.get_supported_glossary_formats()` client method. :keyword str format_version: File format version. If not specified, the service will use the default_version for the file format returned from the - :func:`~DocumentTranslationClient.get_glossary_formats()` client method. + :func:`~DocumentTranslationClient.get_supported_glossary_formats()` client method. :keyword str storage_source: Storage Source. Default value: "AzureBlob". Currently only "AzureBlob" is supported. @@ -33,10 +33,10 @@ class TranslationGlossary(object): # pylint: disable=useless-object-inheritance the glossary file in the storage blob container. If the translation language pair is not present in the glossary, it will not be applied. :ivar str file_format: Required. Format of the glossary file. To see supported formats, - call the :func:`~DocumentTranslationClient.get_glossary_formats()` client method. + call the :func:`~DocumentTranslationClient.get_supported_glossary_formats()` client method. :ivar str format_version: File format version. If not specified, the service will use the default_version for the file format returned from the - :func:`~DocumentTranslationClient.get_glossary_formats()` client method. + :func:`~DocumentTranslationClient.get_supported_glossary_formats()` client method. :ivar str storage_source: Storage Source. Default value: "AzureBlob". Currently only "AzureBlob" is supported. """ diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py index 4a461a8827d4..c3c9fecceb8e 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py @@ -374,7 +374,7 @@ async def get_document_status(self, translation_id, document_id, **kwargs): return DocumentStatus._from_generated(document_status) @distributed_trace_async - async def get_glossary_formats(self, **kwargs): + async def get_supported_glossary_formats(self, **kwargs): # type: (**Any) -> List[FileFormat] """Get the list of the glossary formats supported by the Document Translation service. diff --git a/sdk/translation/azure-ai-translation-document/tests/test_supported_formats.py b/sdk/translation/azure-ai-translation-document/tests/test_supported_formats.py index e27f3ce7a32a..d2d5e59025da 100644 --- a/sdk/translation/azure-ai-translation-document/tests/test_supported_formats.py +++ b/sdk/translation/azure-ai-translation-document/tests/test_supported_formats.py @@ -27,7 +27,7 @@ def test_supported_document_formats(self, client): @DocumentTranslationClientPreparer() def test_supported_glossary_formats(self, client): # get supported formats - supported_glossary_formats = client.get_glossary_formats() + supported_glossary_formats = client.get_supported_glossary_formats() self.assertIsNotNone(supported_glossary_formats) # validate for glossary_format in supported_glossary_formats: diff --git a/sdk/translation/azure-ai-translation-document/tests/test_supported_formats_async.py b/sdk/translation/azure-ai-translation-document/tests/test_supported_formats_async.py index 6d0f0507cdd1..54bdc66f3c8e 100644 --- a/sdk/translation/azure-ai-translation-document/tests/test_supported_formats_async.py +++ b/sdk/translation/azure-ai-translation-document/tests/test_supported_formats_async.py @@ -27,7 +27,7 @@ async def test_supported_document_formats(self, client): @DocumentTranslationClientPreparer() async def test_supported_glossary_formats(self, client): # get supported formats - supported_glossary_formats = await client.get_glossary_formats() + supported_glossary_formats = await client.get_supported_glossary_formats() self.assertIsNotNone(supported_glossary_formats) # validate for glossary_format in supported_glossary_formats: From 5eb54fbd812e6ca515c27b6b49b9460a91184cc9 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Jun 2021 16:32:49 -0700 Subject: [PATCH 5/6] update changelog --- sdk/translation/azure-ai-translation-document/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/translation/azure-ai-translation-document/CHANGELOG.md b/sdk/translation/azure-ai-translation-document/CHANGELOG.md index 72982cdf6d27..68a5384550d1 100644 --- a/sdk/translation/azure-ai-translation-document/CHANGELOG.md +++ b/sdk/translation/azure-ai-translation-document/CHANGELOG.md @@ -2,6 +2,12 @@ ## 1.0.0b3 (Unreleased) +**Breaking changes** + +- `TranslationStatusResult` was renamed to `TranslationStatus`. +- `DocumentStatusResult` was renamed to `DocumentStatus`. +- `get_document_formats` was renamed to `get_supported_document_formats`. +- `get_glossary_formats` was renamed to `get_supported_glossary_formats`. ## 1.0.0b2 (2021-06-08) From c398dc9332cbf70ddb1b92c85b0d7bc6433914a7 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Jun 2021 16:40:56 -0700 Subject: [PATCH 6/6] fix naming clash with generated type --- .../azure/ai/translation/document/_polling.py | 6 +++--- .../azure/ai/translation/document/aio/_async_polling.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py index bb97aacc92fb..c4f9c652c9f3 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py @@ -17,7 +17,7 @@ ) from azure.core.exceptions import HttpResponseError, ODataV4Format -from ._generated.models import TranslationStatus +from ._generated.models import TranslationStatus as _TranslationStatus from ._models import TranslationStatus @@ -89,8 +89,8 @@ def __init__(self, *args, **kwargs): @property def _current_body(self): - # type: () -> TranslationStatus - return TranslationStatus.deserialize(self._pipeline_response) + # type: () -> _TranslationStatus + return _TranslationStatus.deserialize(self._pipeline_response) def _get_id_from_headers(self): # type: () -> str diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py index 74cd1f27a13a..d2e33fc6cce7 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py @@ -11,7 +11,7 @@ _raise_if_bad_http_status_and_method, ) from azure.core.polling.async_base_polling import AsyncLROBasePolling -from .._generated.models import TranslationStatus +from .._generated.models import TranslationStatus as _TranslationStatus from .._models import TranslationStatus PollingReturnType = TypeVar("PollingReturnType") @@ -72,8 +72,8 @@ def __init__(self, *args, **kwargs): super(AsyncDocumentTranslationLROPollingMethod, self).__init__(*args, **kwargs) @property - def _current_body(self) -> TranslationStatus: - return TranslationStatus.deserialize(self._pipeline_response) + def _current_body(self) -> _TranslationStatus: + return _TranslationStatus.deserialize(self._pipeline_response) def _get_id_from_headers(self) -> str: return self._pipeline_response.http_response.headers[