diff --git a/eng/tox/mypy_hard_failure_packages.py b/eng/tox/mypy_hard_failure_packages.py index c73f370d5de1..b85c70560081 100644 --- a/eng/tox/mypy_hard_failure_packages.py +++ b/eng/tox/mypy_hard_failure_packages.py @@ -13,6 +13,7 @@ "azure-servicebus", "azure-ai-textanalytics", "azure-ai-formrecognizer", + "azure-ai-translation-document", "azure-ai-metricsadvisor", "azure-eventgrid", "azure-appconfiguration", 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 f46d46774234..ed5d46bf3477 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 @@ -100,13 +100,13 @@ def close(self): """Close the :class:`~azure.ai.translation.document.DocumentTranslationClient` session.""" return self._client.close() - @overload - def begin_translation(self, source_url, target_url, target_language_code, **kwargs): + @overload # type: ignore + def begin_translation(self, source_url, target_url, target_language_code, **kwargs): # type: ignore # type: (str, str, str, **Any) -> DocumentTranslationLROPoller[ItemPaged[DocumentStatus]] pass - @overload - def begin_translation(self, inputs, **kwargs): + @overload # type: ignore + def begin_translation(self, inputs, **kwargs): # type: ignore # type: (List[DocumentTranslationInput], **Any) -> DocumentTranslationLROPoller[ItemPaged[DocumentStatus]] pass @@ -301,7 +301,7 @@ def _convert_from_generated_model( ], ) - return self._client.document_translation.get_translations_status( + return self._client.document_translation.get_translations_status( # type: ignore cls=model_conversion_function, maxpagesize=results_per_page, created_date_time_utc_start=created_after, @@ -375,7 +375,7 @@ def _convert_from_generated_model(generated_model): ], ) - return self._client.document_translation.get_documents_status( + return self._client.document_translation.get_documents_status( # type: ignore id=translation_id, cls=model_conversion_function, maxpagesize=results_per_page, 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 ad194c453228..badf0a969fe4 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 @@ -48,12 +48,12 @@ def id(self): :rtype: str """ - if self._polling_method._current_body: # pylint: disable=protected-access + if self._polling_method._current_body: # type: ignore # pylint: disable=protected-access return ( - self._polling_method._current_body.id # pylint: disable=protected-access + self._polling_method._current_body.id # type: ignore # pylint: disable=protected-access ) return ( - self._polling_method._get_id_from_headers() # pylint: disable=protected-access + self._polling_method._get_id_from_headers() # type: ignore # pylint: disable=protected-access ) @property @@ -63,14 +63,14 @@ def details(self): :rtype: ~azure.ai.translation.document.TranslationStatus """ - if self._polling_method._current_body: # pylint: disable=protected-access + if self._polling_method._current_body: # type: ignore # pylint: disable=protected-access return TranslationStatus._from_generated( # pylint: disable=protected-access - self._polling_method._current_body # pylint: disable=protected-access + self._polling_method._current_body # type: ignore # pylint: disable=protected-access ) - return TranslationStatus(id=self._polling_method._get_id_from_headers()) # pylint: disable=protected-access + return TranslationStatus(id=self._polling_method._get_id_from_headers()) # type: ignore # pylint: disable=protected-access @classmethod - def from_continuation_token(cls, polling_method, continuation_token, **kwargs): + def from_continuation_token(cls, polling_method, continuation_token, **kwargs): # type: ignore # type: (DocumentTranslationLROPollingMethod, str, **Any) -> DocumentTranslationLROPoller ( @@ -124,7 +124,7 @@ def get_continuation_token(self): return self._current_body.id return self._get_id_from_headers() - def from_continuation_token(self, continuation_token, **kwargs): + def from_continuation_token(self, continuation_token, **kwargs): # type: ignore # type: (str, Any) -> Tuple try: client = kwargs["client"] 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 79efe2f85c82..7e97cf60423e 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 @@ -29,12 +29,12 @@ def id(self) -> str: :rtype: str """ - if self._polling_method._current_body: # pylint: disable=protected-access + if self._polling_method._current_body: # type: ignore # pylint: disable=protected-access return ( - self._polling_method._current_body.id # pylint: disable=protected-access + self._polling_method._current_body.id # type: ignore # pylint: disable=protected-access ) return ( - self._polling_method._get_id_from_headers() # pylint: disable=protected-access + self._polling_method._get_id_from_headers() # type: ignore # pylint: disable=protected-access ) @property @@ -43,14 +43,14 @@ def details(self) -> TranslationStatus: :rtype: ~azure.ai.translation.document.TranslationStatus """ - if self._polling_method._current_body: # pylint: disable=protected-access + if self._polling_method._current_body: # type: ignore # pylint: disable=protected-access return TranslationStatus._from_generated( # pylint: disable=protected-access - self._polling_method._current_body # pylint: disable=protected-access + self._polling_method._current_body # type: ignore # pylint: disable=protected-access ) - return TranslationStatus(id=self._polling_method._get_id_from_headers()) # pylint: disable=protected-access + return TranslationStatus(id=self._polling_method._get_id_from_headers()) # type: ignore # pylint: disable=protected-access @classmethod - def from_continuation_token( + def from_continuation_token( # type: ignore cls, polling_method: "AsyncDocumentTranslationLROPollingMethod", continuation_token: str, @@ -63,7 +63,7 @@ def from_continuation_token( deserialization_callback, ) = polling_method.from_continuation_token(continuation_token, **kwargs) - return cls(client, initial_response, deserialization_callback, polling_method) + return cls(client, initial_response, deserialization_callback, polling_method) # type: ignore class AsyncDocumentTranslationLROPollingMethod(AsyncLROBasePolling): @@ -105,7 +105,7 @@ def get_continuation_token(self) -> str: return self._current_body.id return self._get_id_from_headers() - def from_continuation_token(self, continuation_token: str, **kwargs: Any) -> Tuple: + def from_continuation_token(self, continuation_token: str, **kwargs: Any) -> Tuple: # type: ignore try: client = kwargs["client"] except KeyError: 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 02ff2d23e53a..5e8364756ea2 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 @@ -310,7 +310,7 @@ def _convert_from_generated_model(generated_model): ], ) - return self._client.document_translation.get_translations_status( + return self._client.document_translation.get_translations_status( # type: ignore cls=model_conversion_function, maxpagesize=results_per_page, created_date_time_utc_start=created_after, @@ -383,7 +383,7 @@ def _convert_from_generated_model(generated_model): ], ) - return self._client.document_translation.get_documents_status( + return self._client.document_translation.get_documents_status( # type: ignore id=translation_id, cls=model_conversion_function, maxpagesize=results_per_page, diff --git a/sdk/translation/azure-ai-translation-document/mypy.ini b/sdk/translation/azure-ai-translation-document/mypy.ini new file mode 100644 index 000000000000..daa382e27d15 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/mypy.ini @@ -0,0 +1,12 @@ +[mypy] +python_version = 3.6 +warn_unused_configs = True +ignore_missing_imports = True + +# Per-module options: + +[mypy-azure.ai.translation.document._generated.*] +ignore_errors = True + +[mypy-azure.core.*] +ignore_errors = True