Skip to content

Commit 9329c43

Browse files
authored
Merge pull request GoogleCloudPlatform#100 from GoogleCloudPlatform/gcloud-update
Update to latest google-cloud-python
2 parents 6229a69 + f55355f commit 9329c43

21 files changed

+140
-68
lines changed

2-structured-data/bookshelf/model_datastore.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,17 @@ def from_datastore(entity):
5151
# [START list]
5252
def list(limit=10, cursor=None):
5353
ds = get_client()
54+
5455
query = ds.query(kind='Book', order=['title'])
55-
it = query.fetch(limit=limit, start_cursor=cursor)
56-
entities, more_results, cursor = it.next_page()
57-
entities = builtin_list(map(from_datastore, entities))
58-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
56+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
57+
page = next(query_iterator.pages)
58+
59+
entities = builtin_list(map(from_datastore, page))
60+
next_cursor = (
61+
query_iterator.next_page_token.decode('utf-8')
62+
if query_iterator.next_page_token else None)
63+
64+
return entities, next_cursor
5965
# [END list]
6066

6167

2-structured-data/requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tox==2.4.1
2-
flake8==3.1.0
2+
flake8==3.2.0
33
flaky==3.3.0
44
pytest==3.0.4
55
pytest-cov==2.4.0

2-structured-data/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Flask==0.11.1
2-
google-cloud==0.20.0
2+
google-cloud==0.21.0
33
gunicorn==19.6.0
44
oauth2client==4.0.0
55
Flask-SQLAlchemy==2.1

3-binary-data/bookshelf/model_datastore.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ def from_datastore(entity):
4848

4949
def list(limit=10, cursor=None):
5050
ds = get_client()
51+
5152
query = ds.query(kind='Book', order=['title'])
52-
it = query.fetch(limit=limit, start_cursor=cursor)
53-
entities, more_results, cursor = it.next_page()
54-
entities = builtin_list(map(from_datastore, entities))
55-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
53+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
54+
page = next(query_iterator.pages)
55+
56+
entities = builtin_list(map(from_datastore, page))
57+
next_cursor = (
58+
query_iterator.next_page_token.decode('utf-8')
59+
if query_iterator.next_page_token else None)
60+
61+
return entities, next_cursor
5662

5763

5864
def read(id):

3-binary-data/requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tox==2.4.1
2-
flake8==3.1.0
2+
flake8==3.2.0
33
flaky==3.3.0
44
pytest==3.0.4
55
pytest-cov==2.4.0

3-binary-data/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Flask==0.11.1
2-
google-cloud==0.20.0
2+
google-cloud==0.21.0
33
gunicorn==19.6.0
44
oauth2client==4.0.0
55
Flask-SQLAlchemy==2.1

4-auth/bookshelf/model_datastore.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ def from_datastore(entity):
4848

4949
def list(limit=10, cursor=None):
5050
ds = get_client()
51+
5152
query = ds.query(kind='Book', order=['title'])
52-
it = query.fetch(limit=limit, start_cursor=cursor)
53-
entities, more_results, cursor = it.next_page()
54-
entities = builtin_list(map(from_datastore, entities))
55-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
53+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
54+
page = next(query_iterator.pages)
55+
56+
entities = builtin_list(map(from_datastore, page))
57+
next_cursor = (
58+
query_iterator.next_page_token.decode('utf-8')
59+
if query_iterator.next_page_token else None)
60+
61+
return entities, next_cursor
5662

5763

5864
# [START list_by_user]
@@ -64,10 +70,16 @@ def list_by_user(user_id, limit=10, cursor=None):
6470
('createdById', '=', user_id)
6571
]
6672
)
67-
it = query.fetch(limit=limit, start_cursor=cursor)
68-
entities, more_results, cursor = it.next_page()
69-
entities = builtin_list(map(from_datastore, entities))
70-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
73+
74+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
75+
page = next(query_iterator.pages)
76+
77+
entities = builtin_list(map(from_datastore, page))
78+
next_cursor = (
79+
query_iterator.next_page_token.decode('utf-8')
80+
if query_iterator.next_page_token else None)
81+
82+
return entities, next_cursor
7183
# [END list_by_user]
7284

7385

4-auth/requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tox==2.4.1
2-
flake8==3.1.0
2+
flake8==3.2.0
33
flaky==3.3.0
44
pytest==3.0.4
55
pytest-cov==2.4.0

4-auth/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Flask==0.11.1
2-
google-cloud==0.20.0
2+
google-cloud==0.21.0
33
gunicorn==19.6.0
44
oauth2client==4.0.0
55
Flask-SQLAlchemy==2.1

5-logging/bookshelf/model_datastore.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ def from_datastore(entity):
4848

4949
def list(limit=10, cursor=None):
5050
ds = get_client()
51+
5152
query = ds.query(kind='Book', order=['title'])
52-
it = query.fetch(limit=limit, start_cursor=cursor)
53-
entities, more_results, cursor = it.next_page()
54-
entities = builtin_list(map(from_datastore, entities))
55-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
53+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
54+
page = next(query_iterator.pages)
55+
56+
entities = builtin_list(map(from_datastore, page))
57+
next_cursor = (
58+
query_iterator.next_page_token.decode('utf-8')
59+
if query_iterator.next_page_token else None)
60+
61+
return entities, next_cursor
5662

5763

5864
def list_by_user(user_id, limit=10, cursor=None):
@@ -63,10 +69,16 @@ def list_by_user(user_id, limit=10, cursor=None):
6369
('createdById', '=', user_id)
6470
]
6571
)
66-
it = query.fetch(limit=limit, start_cursor=cursor)
67-
entities, more_results, cursor = it.next_page()
68-
entities = builtin_list(map(from_datastore, entities))
69-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
72+
73+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
74+
page = next(query_iterator.pages)
75+
76+
entities = builtin_list(map(from_datastore, page))
77+
next_cursor = (
78+
query_iterator.next_page_token.decode('utf-8')
79+
if query_iterator.next_page_token else None)
80+
81+
return entities, next_cursor
7082

7183

7284
def read(id):

5-logging/requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tox==2.4.1
2-
flake8==3.1.0
2+
flake8==3.2.0
33
flaky==3.3.0
44
pytest==3.0.4
55
pytest-cov==2.4.0

5-logging/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Flask==0.11.1
2-
google-cloud==0.20.0
2+
google-cloud==0.21.0
33
gunicorn==19.6.0
44
oauth2client==4.0.0
55
Flask-SQLAlchemy==2.1

6-pubsub/bookshelf/model_datastore.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ def from_datastore(entity):
4848

4949
def list(limit=10, cursor=None):
5050
ds = get_client()
51+
5152
query = ds.query(kind='Book', order=['title'])
52-
it = query.fetch(limit=limit, start_cursor=cursor)
53-
entities, more_results, cursor = it.next_page()
54-
entities = builtin_list(map(from_datastore, entities))
55-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
53+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
54+
page = next(query_iterator.pages)
55+
56+
entities = builtin_list(map(from_datastore, page))
57+
next_cursor = (
58+
query_iterator.next_page_token.decode('utf-8')
59+
if query_iterator.next_page_token else None)
60+
61+
return entities, next_cursor
5662

5763

5864
def list_by_user(user_id, limit=10, cursor=None):
@@ -63,10 +69,16 @@ def list_by_user(user_id, limit=10, cursor=None):
6369
('createdById', '=', user_id)
6470
]
6571
)
66-
it = query.fetch(limit=limit, start_cursor=cursor)
67-
entities, more_results, cursor = it.next_page()
68-
entities = builtin_list(map(from_datastore, entities))
69-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
72+
73+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
74+
page = next(query_iterator.pages)
75+
76+
entities = builtin_list(map(from_datastore, page))
77+
next_cursor = (
78+
query_iterator.next_page_token.decode('utf-8')
79+
if query_iterator.next_page_token else None)
80+
81+
return entities, next_cursor
7082

7183

7284
def read(id):

6-pubsub/requirements-dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
tox==2.4.1
2-
flake8==3.1.0
2+
flake8==3.2.0
33
flaky==3.3.0
44
mock==2.0.0
55
pytest==3.0.4
66
pytest-cov==2.4.0
77
BeautifulSoup4==4.5.1
8-
requests==2.11.1
8+
requests==2.12.0
99
retrying==1.3.3

6-pubsub/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Flask==0.11.1
2-
google-cloud==0.20.0
2+
google-cloud==0.21.0
33
gunicorn==19.6.0
44
oauth2client==4.0.0
55
Flask-SQLAlchemy==2.1
66
PyMySQL==0.7.9
77
Flask-PyMongo==0.4.1
88
PyMongo==3.3.1
99
six==1.10.0
10-
requests[security]==2.11.1
10+
requests[security]==2.12.0
1111
honcho==0.7.1
1212
psq==0.5.0

7-gce/bookshelf/model_datastore.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ def from_datastore(entity):
4848

4949
def list(limit=10, cursor=None):
5050
ds = get_client()
51+
5152
query = ds.query(kind='Book', order=['title'])
52-
it = query.fetch(limit=limit, start_cursor=cursor)
53-
entities, more_results, cursor = it.next_page()
54-
entities = builtin_list(map(from_datastore, entities))
55-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
53+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
54+
page = next(query_iterator.pages)
55+
56+
entities = builtin_list(map(from_datastore, page))
57+
next_cursor = (
58+
query_iterator.next_page_token.decode('utf-8')
59+
if query_iterator.next_page_token else None)
60+
61+
return entities, next_cursor
5662

5763

5864
def list_by_user(user_id, limit=10, cursor=None):
@@ -63,10 +69,16 @@ def list_by_user(user_id, limit=10, cursor=None):
6369
('createdById', '=', user_id)
6470
]
6571
)
66-
it = query.fetch(limit=limit, start_cursor=cursor)
67-
entities, more_results, cursor = it.next_page()
68-
entities = builtin_list(map(from_datastore, entities))
69-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
72+
73+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
74+
page = next(query_iterator.pages)
75+
76+
entities = builtin_list(map(from_datastore, page))
77+
next_cursor = (
78+
query_iterator.next_page_token.decode('utf-8')
79+
if query_iterator.next_page_token else None)
80+
81+
return entities, next_cursor
7082

7183

7284
def read(id):

7-gce/requirements-dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
tox==2.4.1
2-
flake8==3.1.0
2+
flake8==3.2.0
33
flaky==3.3.0
44
mock==2.0.0
55
pytest==3.0.4
66
pytest-cov==2.4.0
77
BeautifulSoup4==4.5.1
8-
requests==2.11.1
8+
requests==2.12.0
99
retrying==1.3.3

7-gce/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Flask==0.11.1
2-
google-cloud==0.20.0
2+
google-cloud==0.21.0
33
gunicorn==19.6.0
44
oauth2client==4.0.0
55
Flask-SQLAlchemy==2.1
66
PyMySQL==0.7.9
77
Flask-PyMongo==0.4.1
88
PyMongo==3.3.1
99
six==1.10.0
10-
requests[security]==2.11.1
10+
requests[security]==2.12.0
1111
honcho==0.7.1
1212
psq==0.5.0

optional-container-engine/bookshelf/model_datastore.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ def from_datastore(entity):
4848

4949
def list(limit=10, cursor=None):
5050
ds = get_client()
51+
5152
query = ds.query(kind='Book', order=['title'])
52-
it = query.fetch(limit=limit, start_cursor=cursor)
53-
entities, more_results, cursor = it.next_page()
54-
entities = builtin_list(map(from_datastore, entities))
55-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
53+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
54+
page = next(query_iterator.pages)
55+
56+
entities = builtin_list(map(from_datastore, page))
57+
next_cursor = (
58+
query_iterator.next_page_token.decode('utf-8')
59+
if query_iterator.next_page_token else None)
60+
61+
return entities, next_cursor
5662

5763

5864
def list_by_user(user_id, limit=10, cursor=None):
@@ -63,10 +69,16 @@ def list_by_user(user_id, limit=10, cursor=None):
6369
('createdById', '=', user_id)
6470
]
6571
)
66-
it = query.fetch(limit=limit, start_cursor=cursor)
67-
entities, more_results, cursor = it.next_page()
68-
entities = builtin_list(map(from_datastore, entities))
69-
return entities, cursor.decode('utf-8') if len(entities) == limit else None
72+
73+
query_iterator = query.fetch(limit=limit, start_cursor=cursor)
74+
page = next(query_iterator.pages)
75+
76+
entities = builtin_list(map(from_datastore, page))
77+
next_cursor = (
78+
query_iterator.next_page_token.decode('utf-8')
79+
if query_iterator.next_page_token else None)
80+
81+
return entities, next_cursor
7082

7183

7284
def read(id):
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
tox==2.4.1
2-
flake8==3.1.0
2+
flake8==3.2.0
33
flaky==3.3.0
44
pytest==3.0.4
55
pytest-cov==2.4.0
66
BeautifulSoup4==4.5.1
7-
requests==2.11.1
7+
requests==2.12.0
88
retrying==1.3.3
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Flask==0.11.1
2-
google-cloud==0.20.0
2+
google-cloud==0.21.0
33
gunicorn==19.6.0
44
oauth2client==4.0.0
55
mock==2.0.0
@@ -8,6 +8,6 @@ PyMySQL==0.7.9
88
Flask-PyMongo==0.4.1
99
PyMongo==3.3.1
1010
six==1.10.0
11-
requests[security]==2.11.1
11+
requests[security]==2.12.0
1212
honcho==0.7.1
1313
psq==0.5.0

0 commit comments

Comments
 (0)