Skip to content

Commit b0725be

Browse files
committed
Fix lint errors
1 parent 1fd0fe2 commit b0725be

2 files changed

Lines changed: 25 additions & 24 deletions

File tree

appengine/standard/migration/memorystore/main.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ def query_for_data():
4242

4343

4444
def get_data(cache_key):
45-
## data = memcache.get('key')
45+
## data = memcache.get('key')
4646
data = client.get(cache_key)
4747

4848
if data is not None:
4949
return data.decode()
5050
else:
5151
data = query_for_data()
52-
## memcache.add('key', data, 60)
52+
## memcache.add('key', data, 60)
5353
client.set(cache_key, data, ex=60)
5454

5555
return data
@@ -58,19 +58,19 @@ def get_data(cache_key):
5858
def add_values(values, expires=3600):
5959
# Add a value if it doesn't exist in the cache
6060
# with a cache expiration of 1 hour.
61-
## memcache.add(key="weather_USA_98105", value="raining", time=3600)
62-
## # Remove one of the values and set by itself first
63-
## first_key = values.keys()[0]
64-
## first_value = values[first_key]
65-
## del values[first_key]
66-
## memcache.add(first_key, first_value, ex=expires)
67-
##
68-
## # Set several values, overwriting any existing values for these keys.
69-
## memcache.set_multi(
70-
## {"USA_98115": "cloudy", "USA_94105": "foggy", "USA_94043": "sunny"},
71-
## key_prefix="weather_",
72-
## time=3600
73-
## )
61+
## memcache.add(key="weather_USA_98105", value="raining", time=3600)
62+
## # Remove one of the values and set by itself first
63+
## first_key = values.keys()[0]
64+
## first_value = values[first_key]
65+
## del values[first_key]
66+
## memcache.add(first_key, first_value, ex=expires)
67+
##
68+
## # Set several values, overwriting any existing values for these keys.
69+
## memcache.set_multi(
70+
## {"USA_98115": "cloudy", "USA_94105": "foggy", "USA_94043": "sunny"},
71+
## key_prefix="weather_",
72+
## time=3600
73+
## )
7474
# Redis mset is similar to memcache.set_multi, but cannot set expirations
7575
client.mset(values)
7676

@@ -84,13 +84,13 @@ def add_values(values, expires=3600):
8484

8585
def increment_counter(name, expires=60, value=0):
8686
# Atomically increment an integer value.
87-
## memcache.set(key="counter", value=0)
87+
## memcache.set(key="counter", value=0)
8888
client.set(name, value, ex=expires)
89-
## memcache.incr("counter")
89+
## memcache.incr("counter")
9090
client.incr(name)
91-
## memcache.incr("counter")
91+
## memcache.incr("counter")
9292
client.incr(name)
93-
## memcache.incr("counter")
93+
## memcache.incr("counter")
9494
client.incr(name)
9595

9696

@@ -102,6 +102,7 @@ def increment_counter(name, expires=60, value=0):
102102
def home():
103103
return render_template('index.html')
104104

105+
105106
@app.route('/showdata', methods=['GET'])
106107
def showdata():
107108
data = get_data('data')
@@ -114,6 +115,7 @@ def showdata():
114115

115116
return render_template('showdata.html', data=data, values=values)
116117

118+
117119
@app.route('/showdata', methods=['POST'])
118120
def savedata():
119121
key = request.form['key']
@@ -126,4 +128,4 @@ def savedata():
126128

127129
if __name__ == '__main__':
128130
# This is used when running locally.
129-
app.run(host='127.0.0.1', port=8080, debug=True)
131+
app.run(host='127.0.0.1', port=8080, debug=True)

appengine/standard/migration/memorystore/main_test.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
from mock import patch
16-
import redis
1716
import uuid
1817

1918
import main
@@ -27,16 +26,16 @@
2726
}
2827

2928

30-
@patch('snippets.query_for_data', return_value= 'data')
29+
@patch('main.query_for_data', return_value='data')
3130
def test_get_data_not_present(query_fn, testbed):
3231
data = main.get_data(KEY_PREFIX + 'key')
3332
query_fn.assert_called_once_with()
3433
assert data == 'data'
35-
assert 'data' == client.get(KEY_PREFIX + 'key')
34+
assert 'data' == main.client.get(KEY_PREFIX + 'key')
3635
main.client.delete(KEY_PREFIX + 'key')
3736

3837

39-
@patch('snippets.query_for_data', return_value='data')
38+
@patch('main.query_for_data', return_value='data')
4039
def test_get_data_present(query_fn, testbed):
4140
main.client.set(KEY_PREFIX + 'key', 'data', 9000)
4241
data = main.get_data()

0 commit comments

Comments
 (0)