From e9ed94a71abe0fd54758bde09ba17d200d3d250b Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Tue, 12 May 2020 21:38:39 -0700 Subject: [PATCH] chore: some lint fixes [(#3751)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3751) * chore: some lint fixes * longer timeout, more retries * disable detect_test.py::test_async_detect_document --- .../samples/snippets/beta_snippets_test.py | 7 +++++-- .../samples/snippets/hybrid_glossaries/hybrid_tutorial.py | 4 ++-- .../snippets/hybrid_glossaries/hybrid_tutorial_tests.py | 4 ++-- .../snippets/translate_v3_batch_translate_text_test.py | 3 +-- ...translate_v3_batch_translate_text_with_glossary_test.py | 5 ++--- .../samples/snippets/translate_v3_create_glossary_test.py | 3 +-- .../samples/snippets/translate_v3_detect_language_test.py | 2 ++ .../samples/snippets/translate_v3_get_glossary_test.py | 3 +-- .../snippets/translate_v3_get_supported_languages_test.py | 2 ++ ...ranslate_v3_get_supported_languages_with_target_test.py | 2 ++ .../samples/snippets/translate_v3_list_glossary_test.py | 3 +-- .../samples/snippets/translate_v3_translate_text_test.py | 2 ++ .../translate_v3_translate_text_with_glossary_test.py | 3 +-- .../translate_v3_translate_text_with_model_test.py | 2 ++ 14 files changed, 26 insertions(+), 19 deletions(-) diff --git a/packages/google-cloud-translate/samples/snippets/beta_snippets_test.py b/packages/google-cloud-translate/samples/snippets/beta_snippets_test.py index ada9e348ba35..4852168567ac 100644 --- a/packages/google-cloud-translate/samples/snippets/beta_snippets_test.py +++ b/packages/google-cloud-translate/samples/snippets/beta_snippets_test.py @@ -14,10 +14,13 @@ # limitations under the License. import os -import pytest import uuid -import beta_snippets + from google.cloud import storage +import pytest + +import beta_snippets + PROJECT_ID = os.environ['GCLOUD_PROJECT'] diff --git a/packages/google-cloud-translate/samples/snippets/hybrid_glossaries/hybrid_tutorial.py b/packages/google-cloud-translate/samples/snippets/hybrid_glossaries/hybrid_tutorial.py index 42f854eb1471..0da84b722078 100644 --- a/packages/google-cloud-translate/samples/snippets/hybrid_glossaries/hybrid_tutorial.py +++ b/packages/google-cloud-translate/samples/snippets/hybrid_glossaries/hybrid_tutorial.py @@ -14,15 +14,15 @@ # [START translate_hybrid_imports] +import html import io import os -import html # Imports the Google Cloud client libraries from google.api_core.exceptions import AlreadyExists +from google.cloud import texttospeech from google.cloud import translate_v3beta1 as translate from google.cloud import vision -from google.cloud import texttospeech # [END translate_hybrid_imports] diff --git a/packages/google-cloud-translate/samples/snippets/hybrid_glossaries/hybrid_tutorial_tests.py b/packages/google-cloud-translate/samples/snippets/hybrid_glossaries/hybrid_tutorial_tests.py index 87e8420a2955..5224ca524a91 100644 --- a/packages/google-cloud-translate/samples/snippets/hybrid_glossaries/hybrid_tutorial_tests.py +++ b/packages/google-cloud-translate/samples/snippets/hybrid_glossaries/hybrid_tutorial_tests.py @@ -15,10 +15,10 @@ import os import sys -from hybrid_tutorial import pic_to_text from hybrid_tutorial import create_glossary -from hybrid_tutorial import translate_text +from hybrid_tutorial import pic_to_text from hybrid_tutorial import text_to_speech +from hybrid_tutorial import translate_text PROJECT_ID = os.environ['GCLOUD_PROJECT'] diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_batch_translate_text_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_batch_translate_text_test.py index 4fa8626a7363..85d03e0b7d57 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_batch_translate_text_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_batch_translate_text_test.py @@ -15,9 +15,8 @@ import os import uuid -import pytest - from google.cloud import storage +import pytest import translate_v3_batch_translate_text diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_batch_translate_text_with_glossary_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_batch_translate_text_with_glossary_test.py index 9af648f758a9..dd2e688786ac 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_batch_translate_text_with_glossary_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_batch_translate_text_with_glossary_test.py @@ -16,11 +16,10 @@ import uuid import backoff -import pytest - from google.api_core.exceptions import DeadlineExceeded, GoogleAPICallError -from google.cloud.exceptions import NotFound from google.cloud import storage +from google.cloud.exceptions import NotFound +import pytest import translate_v3_batch_translate_text_with_glossary import translate_v3_create_glossary diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_create_glossary_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_create_glossary_test.py index 4b1e08ed640e..e133fd3ff4c2 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_create_glossary_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_create_glossary_test.py @@ -16,10 +16,9 @@ import uuid import backoff -import pytest - from google.api_core.exceptions import DeadlineExceeded, GoogleAPICallError from google.cloud.exceptions import NotFound +import pytest import translate_v3_create_glossary import translate_v3_delete_glossary diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_detect_language_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_detect_language_test.py index a538fc68aa6b..2e9df86721c9 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_detect_language_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_detect_language_test.py @@ -13,8 +13,10 @@ # limitations under the License. import os + import translate_v3_detect_language + PROJECT_ID = os.environ["GCLOUD_PROJECT"] diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_get_glossary_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_get_glossary_test.py index 8880bf6de5dd..a2df0a4ba455 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_get_glossary_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_get_glossary_test.py @@ -16,10 +16,9 @@ import uuid import backoff -import pytest - from google.api_core.exceptions import DeadlineExceeded, GoogleAPICallError from google.cloud.exceptions import NotFound +import pytest import translate_v3_create_glossary import translate_v3_delete_glossary diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_get_supported_languages_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_get_supported_languages_test.py index cd4e44a445c0..57ceeb203e8d 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_get_supported_languages_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_get_supported_languages_test.py @@ -13,8 +13,10 @@ # limitations under the License. import os + import translate_v3_get_supported_languages + PROJECT_ID = os.environ["GCLOUD_PROJECT"] diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_get_supported_languages_with_target_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_get_supported_languages_with_target_test.py index aa40efe4bb7a..3b123d9f5c1f 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_get_supported_languages_with_target_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_get_supported_languages_with_target_test.py @@ -13,8 +13,10 @@ # limitations under the License. import os + import translate_v3_get_supported_languages_with_target as get_supported_langs + PROJECT_ID = os.environ["GCLOUD_PROJECT"] diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_list_glossary_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_list_glossary_test.py index d0d38cde9855..04e93470e40e 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_list_glossary_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_list_glossary_test.py @@ -16,10 +16,9 @@ import uuid import backoff -import pytest - from google.api_core.exceptions import DeadlineExceeded, GoogleAPICallError from google.cloud.exceptions import NotFound +import pytest import translate_v3_create_glossary import translate_v3_delete_glossary diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_test.py index 096b8dd847fa..8897b9b527f9 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_test.py @@ -13,8 +13,10 @@ # limitations under the License. import os + import translate_v3_translate_text + PROJECT_ID = os.environ["GCLOUD_PROJECT"] diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_with_glossary_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_with_glossary_test.py index adf66836fde8..bc5403c681b8 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_with_glossary_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_with_glossary_test.py @@ -17,10 +17,9 @@ import uuid import backoff -import pytest - from google.api_core.exceptions import DeadlineExceeded, GoogleAPICallError from google.cloud.exceptions import NotFound +import pytest import translate_v3_create_glossary import translate_v3_delete_glossary diff --git a/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_with_model_test.py b/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_with_model_test.py index 6e6ab37eee16..16a5fc03db99 100644 --- a/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_with_model_test.py +++ b/packages/google-cloud-translate/samples/snippets/translate_v3_translate_text_with_model_test.py @@ -14,8 +14,10 @@ # limitations under the License. import os + import translate_v3_translate_text_with_model + PROJECT_ID = os.environ["GCLOUD_PROJECT"] MODEL_ID = "TRL3128559826197068699"