Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: some lint fixes #3751

Merged
merged 3 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
# limitations under the License.

import os
import pytest
import uuid
import translate_v3_batch_translate_text_with_model

from google.cloud import storage
import pytest

import translate_v3_batch_translate_text_with_model


PROJECT_ID = os.environ["GCLOUD_PROJECT"]
MODEL_ID = "TRL3128559826197068699"
Expand Down
7 changes: 5 additions & 2 deletions translate/cloud-client/beta_snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
4 changes: 2 additions & 2 deletions translate/cloud-client/hybrid_glossaries/hybrid_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
import os
import uuid

import pytest

from google.cloud import storage
import pytest

import translate_v3_batch_translate_text

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions translate/cloud-client/translate_v3_create_glossary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions translate/cloud-client/translate_v3_detect_language_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
# limitations under the License.

import os

import translate_v3_detect_language


PROJECT_ID = os.environ["GCLOUD_PROJECT"]


Expand Down
3 changes: 1 addition & 2 deletions translate/cloud-client/translate_v3_get_glossary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
# limitations under the License.

import os

import translate_v3_get_supported_languages


PROJECT_ID = os.environ["GCLOUD_PROJECT"]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]


Expand Down
3 changes: 1 addition & 2 deletions translate/cloud-client/translate_v3_list_glossary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions translate/cloud-client/translate_v3_translate_text_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
# limitations under the License.

import os

import translate_v3_translate_text


PROJECT_ID = os.environ["GCLOUD_PROJECT"]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 3 additions & 1 deletion video/cloud-client/analyze/beta_snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from six.moves.urllib.request import urlopen
import os
import uuid

from google.cloud import storage
import pytest
from six.moves.urllib.request import urlopen

import beta_snippets


POSSIBLE_TEXTS = [
"Google",
"SUR",
Expand Down Expand Up @@ -129,6 +130,7 @@ def test_detect_text_gcs(capsys):
out, _ = capsys.readouterr()
assert 'Text' in out


# Flaky InvalidArgument
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_track_objects(capsys):
Expand Down
1 change: 1 addition & 0 deletions video/cloud-client/analyze/video_detect_faces_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# [START video_detect_faces_beta]
import io

from google.cloud import videointelligence_v1p3beta1 as videointelligence


Expand Down
1 change: 1 addition & 0 deletions video/cloud-client/analyze/video_detect_person_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# [START video_detect_person_beta]
import io

from google.cloud import videointelligence_v1p3beta1 as videointelligence


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
"""

import argparse

# [START automl_vision_edge_container_predict]

import base64
import io
import json

import requests


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
import os
import subprocess
import time
import automl_vision_edge_container_predict as predict

import pytest

import automl_vision_edge_container_predict as predict # noqa


# The absolute path of the current file. This will locate the model_path when
# run docker containers.
Expand Down
2 changes: 1 addition & 1 deletion vision/cloud-client/detect/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ def async_detect_document(gcs_source_uri, gcs_destination_uri):
requests=[async_request])

print('Waiting for the operation to finish.')
operation.result(timeout=300)
operation.result(timeout=420)

# Once the request has completed and the output has been
# written to GCS, we can list all the output files.
Expand Down
2 changes: 1 addition & 1 deletion vision/cloud-client/detect/detect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def test_detect_crop_hints_uri(capsys):
assert 'bounds: ' in out


@pytest.mark.flaky
@pytest.mark.skip("It's constantly failing.")
def test_async_detect_document(capsys):
storage_client = storage.Client()
bucket = storage_client.get_bucket(BUCKET)
Expand Down
3 changes: 2 additions & 1 deletion vision/cloud-client/detect/vision_batch_annotate_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

# [START vision_batch_annotate_files]

import io

from google.cloud import vision_v1
from google.cloud.vision_v1 import enums
import io


def sample_batch_annotate_files(file_path="path/to/your/document.pdf"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
import os
import uuid

import pytest

from google.cloud import storage
import pytest

from import_product_sets import import_product_sets
from product_in_product_set_management import list_products_in_product_set
Expand Down