Skip to content

Commit

Permalink
Adds updates for samples profiler ... vision (#2439)
Browse files Browse the repository at this point in the history
  • Loading branch information
gguuss authored and crwilcox committed Oct 7, 2019
1 parent 2a35d64 commit 78c213a
Show file tree
Hide file tree
Showing 44 changed files with 89 additions and 87 deletions.
4 changes: 2 additions & 2 deletions profiler/appengine/flexible/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Flask==1.0.2
Flask==1.1.1
gunicorn==19.9.0
google-cloud-profiler
google-cloud-profiler==1.0.8
4 changes: 2 additions & 2 deletions profiler/appengine/standard_python37/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Flask==1.0.2
google-cloud-profiler
Flask==1.1.1
google-cloud-profiler==1.0.8
2 changes: 1 addition & 1 deletion profiler/quickstart/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-profiler
google-cloud-profiler==1.0.8
2 changes: 1 addition & 1 deletion pubsub/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-pubsub==0.39.1
google-cloud-pubsub==1.0.0
2 changes: 2 additions & 0 deletions pubsub/cloud-client/subscriber_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import time

from gcp_devrel.testing import eventually_consistent
from gcp_devrel.testing.flaky import flaky
from google.cloud import pubsub_v1
import google.api_core.exceptions
import mock
Expand Down Expand Up @@ -193,6 +194,7 @@ def new_sleep(period):
return mock.patch('time.sleep', new=new_sleep)


@flaky
def test_receive(publisher_client, topic, subscription, capsys):
_publish_messages(publisher_client, topic)

Expand Down
4 changes: 2 additions & 2 deletions run/pubsub/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Flask==1.0.2
pytest==4.3.1
Flask==1.1.1
pytest==5.1.3
gunicorn==19.9.0
4 changes: 2 additions & 2 deletions scheduler/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Flask==1.0.2
Flask==1.1.1
gunicorn==19.9.0
google-cloud-scheduler==0.1.0
google-cloud-scheduler==1.2.1
4 changes: 2 additions & 2 deletions spanner/cloud-client/bulk_load_csv/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-spanner==1.7.1
futures==3.2.0; python_version < "3"
google-cloud-spanner==1.10.0
futures==3.3.0; python_version < "3"
2 changes: 1 addition & 1 deletion spanner/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-spanner==1.10.0
futures==3.2.0; python_version < "3"
futures==3.3.0; python_version < "3"
2 changes: 1 addition & 1 deletion speech/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-speech==0.36.3
google-cloud-speech==1.2.0
2 changes: 1 addition & 1 deletion speech/microphone/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-cloud-speech==0.36.3
google-cloud-speech==1.2.0
pyaudio==0.2.11
six==1.12.0
20 changes: 10 additions & 10 deletions storage/api/customer_supplied_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ def upload_object(bucket, filename, encryption_key, key_hash):


def download_object(bucket, obj, out_file, encryption_key, key_hash):
"""Downloads an object protected by a custom encryption key."""
service = create_service()
"""Downloads an object protected by a custom encryption key."""
service = create_service()

request = service.objects().get_media(bucket=bucket, object=obj)
request.headers['x-goog-encryption-algorithm'] = 'AES256'
request.headers['x-goog-encryption-key'] = encryption_key
request.headers['x-goog-encryption-key-sha256'] = key_hash
request = service.objects().get_media(bucket=bucket, object=obj)
request.headers['x-goog-encryption-algorithm'] = 'AES256'
request.headers['x-goog-encryption-key'] = encryption_key
request.headers['x-goog-encryption-key-sha256'] = key_hash

# Unfortunately, http.MediaIoBaseDownload overwrites HTTP headers,
# and so it cannot be used here. Instead, we shall download as a
# single request.
out_file.write(request.execute())
# Unfortunately, http.MediaIoBaseDownload overwrites HTTP headers,
# and so it cannot be used here. Instead, we shall download as a
# single request.
out_file.write(request.execute())


def rotate_key(bucket, obj, current_encryption_key, current_key_hash,
Expand Down
4 changes: 2 additions & 2 deletions storage/api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-api-python-client==1.7.8
google-auth==1.6.2
google-api-python-client==1.7.11
google-auth==1.6.3
google-auth-httplib2==0.0.3
2 changes: 1 addition & 1 deletion storage/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-pubsub==0.39.1
google-cloud-pubsub==1.0.0
google-cloud-storage==1.19.1
2 changes: 1 addition & 1 deletion storage/s3-sdk/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
boto3==1.9.38
boto3==1.9.236
4 changes: 2 additions & 2 deletions storage/signed_urls/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-cloud-storage==1.13.2
google-auth==1.6.2
google-cloud-storage==1.19.1
google-auth==1.6.3
six==1.12.0
2 changes: 1 addition & 1 deletion storage/transfer_service/aws_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def main(description, project_id, start_date, start_time, source_bucket,
parser.add_argument('source_bucket', help='AWS source bucket name.')
parser.add_argument('access_key_id', help='Your AWS access key id.')
parser.add_argument(
'secret_access_key',
'secret_access_key',
help='Your AWS secret access key.'
)
parser.add_argument('sink_bucket', help='GCS sink bucket name.')
Expand Down
4 changes: 2 additions & 2 deletions storage/transfer_service/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-api-python-client==1.7.8
google-auth==1.6.2
google-api-python-client==1.7.11
google-auth==1.6.3
google-auth-httplib2==0.0.3
2 changes: 1 addition & 1 deletion tasks/create_http_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def create_http_task(project,
# location = 'us-central1'
# url = 'https://example.com/task_handler'
# payload = 'hello'
in_seconds = 10

# Construct the fully qualified queue name.
parent = client.queue_path(project, location, queue)
Expand All @@ -57,6 +56,7 @@ def create_http_task(project,

# Add the payload to the request.
task['http_request']['body'] = converted_payload

if in_seconds is not None:
# Convert "seconds from now" into an rfc3339 datetime string.
d = datetime.datetime.utcnow() + datetime.timedelta(seconds=in_seconds)
Expand Down
2 changes: 1 addition & 1 deletion tasks/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-tasks==1.1.0
google-cloud-tasks==1.2.1
googleapis-common-protos==1.6.0
26 changes: 13 additions & 13 deletions testing/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
beautifulsoup4==4.7.1
coverage==4.5.2
flaky==3.5.3
beautifulsoup4==4.8.0
coverage==4.5.4
flaky==3.6.1
funcsigs==1.0.2
mock==2.0.0
mock==3.0.5
mysql-python==1.2.5; python_version < "3.0"
PyCrypto==2.6.1
pytest-cov==2.6.1
pytest==5.2.0
pyyaml==3.13
responses==0.10.5
WebTest==2.0.32
pytest-cov==2.7.1
pytest==4.6.5
pyyaml==5.1.2
responses==0.10.6
WebTest==2.0.33
webapp2==2.5.2
google-api-python-client==1.7.8
google-cloud-core==0.29.1
google-api-python-client==1.7.11
google-cloud-core==1.0.3
gcp-devrel-py-tools==0.0.15
flask==1.0.2
websocket-client==0.54.0
flask==1.1.1
websocket-client==0.56.0
2 changes: 1 addition & 1 deletion texttospeech/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-texttospeech==0.4.0
google-cloud-texttospeech==0.5.0
1 change: 0 additions & 1 deletion texttospeech/cloud-client/ssml_addresses_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from ssml_addresses import text_to_ssml
from ssml_addresses import ssml_to_audio

import filecmp
import os


Expand Down
8 changes: 4 additions & 4 deletions trace/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
google-cloud-trace==0.21.0
opencensus==0.6.0
opencensus-ext-stackdriver==0.4.0
Flask==1.0.2
google-cloud-trace==0.22.1
opencensus==0.7.3
opencensus-ext-stackdriver==0.7.2
Flask==1.1.1
2 changes: 1 addition & 1 deletion translate/automl/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-automl==0.2.0
google-cloud-automl==0.5.0
2 changes: 0 additions & 2 deletions translate/cloud-client/beta_snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def test_create_glossary(capsys, unique_glossary_id):
beta_snippets.create_glossary(PROJECT_ID, unique_glossary_id)
out, _ = capsys.readouterr()
assert 'Created' in out
assert PROJECT_ID in out
assert unique_glossary_id in out
assert 'gs://cloud-samples-data/translation/glossary.csv' in out

Expand Down Expand Up @@ -129,6 +128,5 @@ def test_delete_glossary(capsys, unique_glossary_id):
beta_snippets.create_glossary(PROJECT_ID, unique_glossary_id)
beta_snippets.delete_glossary(PROJECT_ID, unique_glossary_id)
out, _ = capsys.readouterr()
assert PROJECT_ID in out
assert 'us-central1' in out
assert unique_glossary_id in out
6 changes: 3 additions & 3 deletions translate/cloud-client/hybrid_glossaries/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-cloud-translate==1.4.0
google-cloud-vision==0.35.2
google-cloud-texttospeech==0.4.0
google-cloud-translate==1.6.0
google-cloud-vision==0.39.0
google-cloud-texttospeech==0.5.0
4 changes: 2 additions & 2 deletions translate/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-translate==1.4.0
google-cloud-storage==1.14.0
google-cloud-translate==1.6.0
google-cloud-storage==1.19.1
2 changes: 1 addition & 1 deletion video/cloud-client/analyze/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-videointelligence==1.11.0
google-cloud-storage==1.14.0
google-cloud-storage==1.19.1
2 changes: 1 addition & 1 deletion video/cloud-client/labels/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-videointelligence==1.6.1
google-cloud-videointelligence==1.11.0
2 changes: 1 addition & 1 deletion video/cloud-client/quickstart/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-videointelligence==1.6.1
google-cloud-videointelligence==1.11.0
2 changes: 1 addition & 1 deletion video/cloud-client/shotchange/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-videointelligence==1.6.1
google-cloud-videointelligence==1.11.0
2 changes: 1 addition & 1 deletion vision/automl/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-automl==0.2.0
google-cloud-automl==0.5.0
4 changes: 2 additions & 2 deletions vision/cloud-client/crop_hints/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-vision==0.35.2
pillow==5.4.1
google-cloud-vision==0.39.0
pillow==6.1.0
2 changes: 1 addition & 1 deletion vision/cloud-client/detect/beta_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def async_batch_annotate_images_uri(input_image_uri, output_uri):
bucket_name = match.group(1)
prefix = match.group(2)

bucket = storage_client.get_bucket(bucket_name=bucket_name)
bucket = storage_client.get_bucket(bucket_name)

# Lists objects with the given prefix.
blob_list = list(bucket.list_blobs(prefix=prefix))
Expand Down
6 changes: 3 additions & 3 deletions vision/cloud-client/detect/detect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,22 @@ def test_detect_crop_hints(capsys):
'resources/wakeupcat.jpg')
detect.detect_crop_hints(file_name)
out, _ = capsys.readouterr()
assert 'bounds: (0,0)' in out
assert 'bounds: ' in out


def test_detect_crop_hints_uri(capsys):
file_name = 'gs://{}/vision/label/wakeupcat.jpg'.format(ASSET_BUCKET)
detect.detect_crop_hints_uri(file_name)
out, _ = capsys.readouterr()
assert 'bounds: (0,0)' in out
assert 'bounds: ' in out


def test_detect_crop_hints_http(capsys):
uri = 'https://storage-download.googleapis.com/{}' \
'/vision/label/wakeupcat.jpg'
detect.detect_crop_hints_uri(uri.format(ASSET_BUCKET))
out, _ = capsys.readouterr()
assert 'bounds: (0,0)' in out
assert 'bounds: ' in out


def test_async_detect_document(capsys):
Expand Down
4 changes: 2 additions & 2 deletions vision/cloud-client/detect/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-vision==0.36.0
google-cloud-storage==1.13.2
google-cloud-vision==0.39.0
google-cloud-storage==1.19.1
2 changes: 1 addition & 1 deletion vision/cloud-client/document_text/doctext.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def render_doc_text(filein, fileout):
bounds = get_document_bounds(filein, FeatureType.WORD)
draw_boxes(image, bounds, 'yellow')

if fileout is not 0:
if fileout != 0:
image.save(fileout)
else:
image.show()
Expand Down
4 changes: 2 additions & 2 deletions vision/cloud-client/document_text/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-vision==0.35.2
pillow==5.4.1
google-cloud-vision==0.39.0
pillow==6.1.0
3 changes: 2 additions & 1 deletion vision/cloud-client/face_detection/faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def detect_face(face_file, max_results=4):
content = face_file.read()
image = types.Image(content=content)

return client.face_detection(image=image, max_results=max_results).face_annotations
return client.face_detection(
image=image, max_results=max_results).face_annotations
# [END vision_face_detection_tutorial_send_request]


Expand Down
4 changes: 2 additions & 2 deletions vision/cloud-client/face_detection/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-vision==0.35.2
Pillow==5.4.1
google-cloud-vision==0.39.0
Pillow==6.1.0
2 changes: 1 addition & 1 deletion vision/cloud-client/quickstart/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-vision==0.35.2
google-cloud-vision==0.39.0
2 changes: 1 addition & 1 deletion vision/cloud-client/web/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-vision==0.35.2
google-cloud-vision==0.39.0
8 changes: 5 additions & 3 deletions vision/cloud-client/web/web_detect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@ def test_detect_file(capsys):
web_detect.report(web_detect.annotate(file_name))
out, _ = capsys.readouterr()
print(out)
assert 'description: palace of fine arts' in out.lower()
assert 'description' in out.lower()
assert 'palace' in out.lower()


def test_detect_web_gsuri(capsys):
file_name = ('gs://{}/vision/landmark/pofa.jpg'.format(
ASSET_BUCKET))
web_detect.report(web_detect.annotate(file_name))
out, _ = capsys.readouterr()
assert 'description: palace of fine arts' in out.lower()
assert 'description:' in out.lower()
assert 'palace' in out.lower()


def test_detect_web_http(capsys):
web_detect.report(web_detect.annotate(
'https://cloud.google.com/images/products/vision/extract-text.png'))
out, _ = capsys.readouterr()
assert 'https://cloud.google.com/vision' in out
assert 'web entities' in out.lower()

0 comments on commit 78c213a

Please sign in to comment.