Skip to content

Commit

Permalink
Auto-update dependencies. (#1093)
Browse files Browse the repository at this point in the history
* Auto-update dependencies.

* Fix storage notification poll sample

Change-Id: I6afbc79d15e050531555e4c8e51066996717a0f3

* Fix spanner samples

Change-Id: I40069222c60d57e8f3d3878167591af9130895cb

* Drop coverage because it's not useful

Change-Id: Iae399a7083d7866c3c7b9162d0de244fbff8b522

* Try again to fix flaky logging test

Change-Id: I6225c074701970c17c426677ef1935bb6d7e36b4
  • Loading branch information
dpebot authored and Jon Wayne Parrott committed Aug 29, 2017
1 parent 491da30 commit 714f508
Show file tree
Hide file tree
Showing 45 changed files with 129 additions and 129 deletions.
12 changes: 0 additions & 12 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion appengine/flexible/cloudsql_postgresql/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flask==0.12.2
Flask-SQLAlchemy==2.2
gunicorn==19.7.1
psycopg2==2.7.3
psycopg2==2.7.3.1
2 changes: 1 addition & 1 deletion appengine/flexible/datastore/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Flask==0.12.2
google-cloud-datastore==1.2.0
google-cloud-datastore==1.3.0
gunicorn==19.7.1
2 changes: 1 addition & 1 deletion appengine/flexible/django_cloudsql/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Django==1.11.4
mysqlclient==1.3.10
wheel==0.29.0
gunicorn==19.7.1
psycopg2==2.7.3
psycopg2==2.7.3.1
2 changes: 1 addition & 1 deletion appengine/flexible/storage/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Flask==0.12.2
google-cloud-storage==1.3.2
google-cloud-storage==1.4.0
gunicorn==19.7.1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-endpoints==2.2.0
google-endpoints==2.2.1
google-endpoints-api-management==1.1.3
2 changes: 1 addition & 1 deletion auth/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-storage==1.3.2
google-cloud-storage==1.4.0
2 changes: 1 addition & 1 deletion bigquery/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-cloud-bigquery==0.26.0
google-cloud-bigquery==0.27.0
google-auth-oauthlib==0.1.0
pytz==2017.2
4 changes: 2 additions & 2 deletions bigtable/hello/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-bigtable==0.26.0
google-cloud-core==0.26.0
google-cloud-bigtable==0.27.0
google-cloud-core==0.27.0
4 changes: 2 additions & 2 deletions bigtable/hello_happybase/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-cloud-happybase==0.26.0
google-cloud-bigtable==0.26.0
google-cloud-core==0.26.0
google-cloud-bigtable==0.27.0
google-cloud-core==0.27.0
4 changes: 2 additions & 2 deletions bigtable/metricscaler/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-bigtable==0.26.0
google-cloud-monitoring==0.26.0
google-cloud-bigtable==0.27.0
google-cloud-monitoring==0.27.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-datastore==1.2.0
google-cloud-datastore==1.3.0
6 changes: 3 additions & 3 deletions codelabs/flex_and_vision/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Flask==0.12.2
gunicorn==19.7.1
google-cloud-vision==0.26.0
google-cloud-storage==1.3.2
google-cloud-datastore==1.2.0
google-cloud-vision==0.27.0
google-cloud-storage==1.4.0
google-cloud-datastore==1.3.0
2 changes: 1 addition & 1 deletion container_engine/django_tutorial/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Django==1.11.4
mysqlclient==1.3.10
wheel==0.29.0
gunicorn==19.7.1
psycopg2==2.7.3
psycopg2==2.7.3.1
2 changes: 1 addition & 1 deletion datastore/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-datastore==1.2.0
google-cloud-datastore==1.3.0
2 changes: 1 addition & 1 deletion dns/api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-dns==0.26.0
google-cloud-dns==0.27.0
2 changes: 1 addition & 1 deletion error_reporting/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-error-reporting==0.26.0
google-cloud-error-reporting==0.27.0
2 changes: 1 addition & 1 deletion iot/api-client/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-pubsub==0.27.0
google-cloud-pubsub==0.28.2
2 changes: 1 addition & 1 deletion language/cloud-client/v1/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-language==0.27.0
google-cloud-language==0.28.0
2 changes: 1 addition & 1 deletion language/cloud-client/v1beta2/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-language==0.27.0
google-cloud-language==0.28.0
2 changes: 1 addition & 1 deletion language/sentiment/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-language==0.27.0
google-cloud-language==0.28.0
2 changes: 1 addition & 1 deletion logging/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-logging==1.2.0
google-cloud-logging==1.3.0
4 changes: 3 additions & 1 deletion logging/cloud-client/snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ def test_write():


def test_delete(example_log):
snippets.delete_logger(TEST_LOGGER_NAME)
@eventually_consistent.call
def _():
snippets.delete_logger(TEST_LOGGER_NAME)
2 changes: 1 addition & 1 deletion monitoring/api/v3/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-monitoring==0.26.0
google-cloud-monitoring==0.27.0
5 changes: 1 addition & 4 deletions nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ def _setup_appengine_sdk(session):
#


PYTEST_COMMON_ARGS = [
'--cov',
'--cov-config', os.path.abspath('.coveragerc'),
'--cov-report', 'term']
PYTEST_COMMON_ARGS = []

FLAKE8_COMMON_ARGS = [
'--show-source', '--builtin', 'gettext', '--max-complexity', '20',
Expand Down
7 changes: 4 additions & 3 deletions spanner/cloud-client/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ def run_quickstart():
database = instance.database(database_id)

# Execute a simple SQL statement.
results = database.execute_sql('SELECT 1')
with database.snapshot() as snapshot:
results = snapshot.execute_sql('SELECT 1')

for row in results:
print(row)
for row in results:
print(row)
# [END spanner_quickstart]


Expand Down
2 changes: 1 addition & 1 deletion spanner/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-spanner==0.26.0
google-cloud-spanner==0.27.0
92 changes: 50 additions & 42 deletions spanner/cloud-client/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ def query_data(instance_id, database_id):
instance = spanner_client.instance(instance_id)
database = instance.database(database_id)

results = database.execute_sql(
'SELECT SingerId, AlbumId, AlbumTitle FROM Albums')
with database.snapshot() as snapshot:
results = snapshot.execute_sql(
'SELECT SingerId, AlbumId, AlbumTitle FROM Albums')

for row in results:
print(u'SingerId: {}, AlbumId: {}, AlbumTitle: {}'.format(*row))
for row in results:
print(u'SingerId: {}, AlbumId: {}, AlbumTitle: {}'.format(*row))


def read_data(instance_id, database_id):
Expand All @@ -107,14 +108,15 @@ def read_data(instance_id, database_id):
instance = spanner_client.instance(instance_id)
database = instance.database(database_id)

keyset = spanner.KeySet(all_=True)
results = database.read(
table='Albums',
columns=('SingerId', 'AlbumId', 'AlbumTitle',),
keyset=keyset,)
with database.snapshot() as snapshot:
keyset = spanner.KeySet(all_=True)
results = snapshot.read(
table='Albums',
columns=('SingerId', 'AlbumId', 'AlbumTitle',),
keyset=keyset,)

for row in results:
print(u'SingerId: {}, AlbumId: {}, AlbumTitle: {}'.format(*row))
for row in results:
print(u'SingerId: {}, AlbumId: {}, AlbumTitle: {}'.format(*row))


def query_data_with_new_column(instance_id, database_id):
Expand All @@ -130,11 +132,13 @@ def query_data_with_new_column(instance_id, database_id):
instance = spanner_client.instance(instance_id)
database = instance.database(database_id)

results = database.execute_sql(
'SELECT SingerId, AlbumId, MarketingBudget FROM Albums')
with database.snapshot() as snapshot:
results = snapshot.execute_sql(
'SELECT SingerId, AlbumId, MarketingBudget FROM Albums')

for row in results:
print(u'SingerId: {}, AlbumId: {}, MarketingBudget: {}'.format(*row))
for row in results:
print(
u'SingerId: {}, AlbumId: {}, MarketingBudget: {}'.format(*row))


def add_index(instance_id, database_id):
Expand Down Expand Up @@ -183,16 +187,18 @@ def query_data_with_index(
'start_title': type_pb2.Type(code=type_pb2.STRING),
'end_title': type_pb2.Type(code=type_pb2.STRING)
}
results = database.execute_sql(
"SELECT AlbumId, AlbumTitle, MarketingBudget "
"FROM Albums@{FORCE_INDEX=AlbumsByAlbumTitle} "
"WHERE AlbumTitle >= @start_title AND AlbumTitle < @end_title",
params=params, param_types=param_types)

for row in results:
print(
u'AlbumId: {}, AlbumTitle: {}, '
'MarketingBudget: {}'.format(*row))
with database.snapshot() as snapshot:
results = snapshot.execute_sql(
"SELECT AlbumId, AlbumTitle, MarketingBudget "
"FROM Albums@{FORCE_INDEX=AlbumsByAlbumTitle} "
"WHERE AlbumTitle >= @start_title AND AlbumTitle < @end_title",
params=params, param_types=param_types)

for row in results:
print(
u'AlbumId: {}, AlbumTitle: {}, '
'MarketingBudget: {}'.format(*row))


def read_data_with_index(instance_id, database_id):
Expand All @@ -209,15 +215,16 @@ def read_data_with_index(instance_id, database_id):
instance = spanner_client.instance(instance_id)
database = instance.database(database_id)

keyset = spanner.KeySet(all_=True)
results = database.read(
table='Albums',
columns=('AlbumId', 'AlbumTitle'),
keyset=keyset,
index='AlbumsByAlbumTitle')
with database.snapshot() as snapshot:
keyset = spanner.KeySet(all_=True)
results = snapshot.read(
table='Albums',
columns=('AlbumId', 'AlbumTitle'),
keyset=keyset,
index='AlbumsByAlbumTitle')

for row in results:
print('AlbumId: {}, AlbumTitle: {}'.format(*row))
for row in results:
print('AlbumId: {}, AlbumTitle: {}'.format(*row))


def add_storing_index(instance_id, database_id):
Expand Down Expand Up @@ -252,17 +259,18 @@ def read_data_with_storing_index(instance_id, database_id):
instance = spanner_client.instance(instance_id)
database = instance.database(database_id)

keyset = spanner.KeySet(all_=True)
results = database.read(
table='Albums',
columns=('AlbumId', 'AlbumTitle', 'MarketingBudget'),
keyset=keyset,
index='AlbumsByAlbumTitle2')
with database.snapshot() as snapshot:
keyset = spanner.KeySet(all_=True)
results = snapshot.read(
table='Albums',
columns=('AlbumId', 'AlbumTitle', 'MarketingBudget'),
keyset=keyset,
index='AlbumsByAlbumTitle2')

for row in results:
print(
u'AlbumId: {}, AlbumTitle: {}, '
'MarketingBudget: {}'.format(*row))
for row in results:
print(
u'AlbumId: {}, AlbumTitle: {}, '
'MarketingBudget: {}'.format(*row))


def add_column(instance_id, database_id):
Expand Down
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.28.0
google-cloud-speech==0.29.0
32 changes: 16 additions & 16 deletions storage/cloud-client/notification_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@

import argparse
import json
import sys
import time

from google.cloud import pubsub
from google.cloud import pubsub_v1


def summarize(message):
# [START parse_message]
data = message.data
data = message.data.decode('utf-8')
attributes = message.attributes

event_type = attributes['eventType']
Expand Down Expand Up @@ -87,24 +87,24 @@ def summarize(message):
# [END parse_message]


def poll_notifications(subscription_id):
def poll_notifications(project, subscription_name):
"""Polls a Cloud Pub/Sub subscription for new GCS events for display."""
# [BEGIN poll_notifications]
client = pubsub.Client()
subscription = pubsub.subscription.Subscription(
subscription_id, client=client)
subscriber = pubsub_v1.SubscriberClient()
subscription_path = subscriber.subscription_path(
project, subscription_name)

if not subscription.exists():
sys.stderr.write('Cannot find subscription {0}\n'.format(sys.argv[1]))
return
def callback(message):
print('Received message:\n{1}'.format(summarize(message)))
message.ack()

print('Polling for messages. Press ctrl+c to exit.')
subscriber.subscribe(subscription_path, callback=callback)

# The subscriber is non-blocking, so we must keep the main thread from
# exiting to allow it to process messages in the background.
print('Listening for messages on {}'.format(subscription_path))
while True:
pulled = subscription.pull(max_messages=100)
for ack_id, message in pulled:
print('Received message {0}:\n{1}'.format(
message.message_id, summarize(message)))
subscription.acknowledge([ack_id])
time.sleep(60)
# [END poll_notifications]


Expand Down
18 changes: 11 additions & 7 deletions storage/cloud-client/notification_polling_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
# limitations under the License.


from google.cloud.pubsub.message import Message
from google.cloud.pubsub_v1.subscriber.message import Message
import mock

from notification_polling import summarize

Expand All @@ -31,12 +32,15 @@ def test_parse_json_message():
'notificationConfig': ('projects/_/buckets/mybucket/'
'notificationConfigs/5'),
'payloadFormat': 'JSON_API_V1'}
data = ('{'
' "size": 12345,'
' "contentType": "text/html",'
' "metageneration": 1'
'}')
message = Message(data, MESSAGE_ID, attributes=attributes)
data = (b'{'
b' "size": 12345,'
b' "contentType": "text/html",'
b' "metageneration": 1'
b'}')
message = Message(
mock.Mock(data=data, attributes=attributes),
MESSAGE_ID,
mock.Mock())
assert summarize(message) == (
'\tEvent type: OBJECT_FINALIZE\n'
'\tBucket ID: mybucket\n'
Expand Down
4 changes: 2 additions & 2 deletions storage/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-storage==1.3.2
google-cloud-pubsub==0.27.0
google-cloud-storage==1.4.0
google-cloud-pubsub==0.28.2
2 changes: 1 addition & 1 deletion testing/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ responses==0.7.0
WebTest==2.0.28
webapp2==2.5.2
google-api-python-client==1.6.2
google-cloud-core==0.26.0
google-cloud-core==0.27.0
gcp-devrel-py-tools==0.0.11
2 changes: 1 addition & 1 deletion translate/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-translate==1.1.0
google-cloud-translate==1.2.0
2 changes: 1 addition & 1 deletion video/cloud-client/analyze/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-videointelligence==0.25.0
google-cloud-videointelligence==0.26.0
2 changes: 1 addition & 1 deletion video/cloud-client/faces/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-videointelligence==0.25.0
google-cloud-videointelligence==0.26.0
Loading

0 comments on commit 714f508

Please sign in to comment.