Skip to content

Commit def3142

Browse files
committed
minor fixes/updates, upgrade to Python 3.9
1 parent e736cc7 commit def3142

File tree

10 files changed

+15
-16
lines changed

10 files changed

+15
-16
lines changed

mod1-flask/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2021 Google LLC
1+
# Copyright 2020 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

mod12-memcache/main.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def store_visit(remote_addr, user_agent):
3030

3131
def fetch_visits(limit):
3232
'get most recent visits'
33-
return [v.to_dict() for v in Visit.query().order(
34-
-Visit.timestamp).fetch(limit)]
33+
return (v.to_dict() for v in Visit.query().order(
34+
-Visit.timestamp).fetch(limit))
3535

3636
@app.route('/')
3737
def root():
@@ -41,11 +41,10 @@ def root():
4141
visitor = '{}: {}'.format(ip_addr, usr_agt)
4242
visits = memcache.get('visits')
4343

44-
# register visit & run DB query if cache empty or new visitor
44+
# if cache empty or new visitor, register visit & run DB query
4545
if not visits or visits[0]['visitor'] != visitor:
4646
store_visit(ip_addr, usr_agt)
47-
visits = fetch_visits(10)
48-
memcache.set('visits', visits, HOUR) # must set() not add() here
47+
visits = list(fetch_visits(10))
48+
memcache.set('visits', visits, HOUR) # set() not add()
4949

50-
# send context to template renderer
5150
return render_template('index.html', visits=visits)

mod12b-memcache/app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
runtime: python38
15+
runtime: python39
1616
app_engine_apis: true

mod1b-flask/app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
runtime: python38
15+
runtime: python39
1616
app_engine_apis: true

mod2b-cloudndb/app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
runtime: python38
15+
runtime: python39

mod3b-datastore/app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
runtime: python38
15+
runtime: python39

mod6-firestore/app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
runtime: python38
15+
runtime: python39
1616

1717
handlers:
1818
- url: /.*

mod7b-gaetasks/app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
runtime: python38
15+
runtime: python39
1616
app_engine_apis: true

mod9-py3fstasks/app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
runtime: python38
15+
runtime: python39

mod9-py3fstasks/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
flask==1.1.2
2-
google-cloud-firestore==2.2.0
3-
google-cloud-tasks==2.5.1
2+
google-cloud-firestore==2.3.4
3+
google-cloud-tasks==2.7.0

0 commit comments

Comments
 (0)