Skip to content

Commit 27391d1

Browse files
committed
Fix various Pep8 1.5.4 errors
Pep8 1.5.4 fixes several bugs in visual indent and spaces detection. Adjust the code accordingly so that it passes once we try to upgrade. Change-Id: I5691ffd29edcb32fdbacd9da7ca71bfcabeeffe5
1 parent 182594e commit 27391d1

File tree

6 files changed

+31
-36
lines changed

6 files changed

+31
-36
lines changed

glance/api/v1/upload_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ def _kill_mismatched(image_meta, attr, actual):
134134
# Update the database with the checksum returned
135135
# from the backend store
136136
LOG.debug(_("Updating image %(image_id)s data. "
137-
"Checksum set to %(checksum)s, size set "
138-
"to %(size)d"), {'image_id': image_id,
139-
'checksum': checksum,
140-
'size': size})
137+
"Checksum set to %(checksum)s, size set "
138+
"to %(size)d"), {'image_id': image_id,
139+
'checksum': checksum,
140+
'size': size})
141141
update_data = {'checksum': checksum,
142142
'size': size}
143143
try:

glance/cmd/replicator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def get_images(self):
153153
response = self._http_request('GET', url, {}, '')
154154
result = jsonutils.loads(response.read())
155155

156-
if not result or not 'images' in result or not result['images']:
156+
if not result or 'images' not in result or not result['images']:
157157
return
158158
for image in result.get('images', []):
159159
params['marker'] = image['id']
@@ -372,8 +372,8 @@ def _dict_diff(a, b):
372372
for key in a:
373373
if str(a[key]) != str(b[key]):
374374
logging.debug(_('metadata diff -- value differs for key '
375-
'%(key)s: master "%(master_value)s" vs '
376-
'slave "%(slave_value)s"') %
375+
'%(key)s: master "%(master_value)s" vs '
376+
'slave "%(slave_value)s"') %
377377
{'key': key, 'master_value': a[key],
378378
'slave_value': b[key]})
379379
return True
@@ -594,8 +594,8 @@ def replication_compare(options, args):
594594
for key in image:
595595
if image[key] != headers.get(key, None):
596596
logging.info(_('%(image_id)s: field %(key)s differs '
597-
'(source is %(master_value)s, destination '
598-
'is %(slave_value)s)')
597+
'(source is %(master_value)s, destination '
598+
'is %(slave_value)s)')
599599
% {'image_id': image['id'],
600600
'key': key,
601601
'master_value': image[key],

glance/tests/functional/v1/test_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def test_get_head_simple_post(self):
358358
# 16. Attempt to replace members with an overlimit amount
359359
# Adding 11 image members should fail since configured limit is 10
360360
path = ("http://%s:%d/v1/images/%s/members" %
361-
("127.0.0.1", self.api_port, image_id))
361+
("127.0.0.1", self.api_port, image_id))
362362
memberships = []
363363
for i in range(11):
364364
member_id = "foo%d" % i
@@ -371,7 +371,7 @@ def test_get_head_simple_post(self):
371371
# 17. Attempt to add a member while at limit
372372
# Adding an 11th member should fail since configured limit is 10
373373
path = ("http://%s:%d/v1/images/%s/members" %
374-
("127.0.0.1", self.api_port, image_id))
374+
("127.0.0.1", self.api_port, image_id))
375375
memberships = []
376376
for i in range(10):
377377
member_id = "foo%d" % i
@@ -382,7 +382,7 @@ def test_get_head_simple_post(self):
382382
self.assertEqual(response.status, 204)
383383

384384
path = ("http://%s:%d/v1/images/%s/members/fail_me" %
385-
("127.0.0.1", self.api_port, image_id))
385+
("127.0.0.1", self.api_port, image_id))
386386
http = httplib2.Http()
387387
response, content = http.request(path, 'PUT')
388388
self.assertEqual(response.status, 413)

glance/tests/functional/v2/test_images.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,7 @@ def test_image_locations_with_order_strategy(self):
20562056
self.assertTrue('locations' in image)
20572057
self.assertTrue(image["locations"] == [])
20582058

2059-
# Update image locations via PATCH
2059+
# Update image locations via PATCH
20602060
path = self._url('/v2/images/%s' % image_id)
20612061
media_type = 'application/openstack-images-v2.1-json-patch'
20622062
headers = self._headers({'content-type': media_type})
@@ -2115,7 +2115,7 @@ def test_image_locatons_with_store_type_strategy(self):
21152115
self.assertTrue('locations' in image)
21162116
self.assertTrue(image["locations"] == [])
21172117

2118-
# Update image locations via PATCH
2118+
# Update image locations via PATCH
21192119
path = self._url('/v2/images/%s' % image_id)
21202120
media_type = 'application/openstack-images-v2.1-json-patch'
21212121
headers = self._headers({'content-type': media_type})

glance/tests/integration/v2/test_tasks_api.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ def test_all_task_api(self):
9797
body_content = json.dumps(task_data)
9898

9999
path = "/v2/tasks"
100-
response, content = self.http.request(path, 'POST',
101-
headers=
102-
minimal_task_headers(task_owner),
103-
body=body_content)
100+
response, content = self.http.request(
101+
path, 'POST', headers=minimal_task_headers(task_owner),
102+
body=body_content)
104103
self.assertEqual(response.status, 201)
105104

106105
data = json.loads(content)
@@ -176,10 +175,9 @@ def test_create_new_task(self):
176175
body_content = json.dumps(task_data)
177176

178177
path = "/v2/tasks"
179-
response, content = self.http.request(path, 'POST',
180-
headers=
181-
minimal_task_headers(task_owner),
182-
body=body_content)
178+
response, content = self.http.request(
179+
path, 'POST', headers=minimal_task_headers(task_owner),
180+
body=body_content)
183181
self.assertEqual(response.status, 201)
184182

185183
data = json.loads(content)
@@ -198,10 +196,9 @@ def test_create_new_task(self):
198196
body_content = json.dumps(task_data)
199197

200198
path = "/v2/tasks"
201-
response, content = self.http.request(path, 'POST',
202-
headers=
203-
minimal_task_headers(task_owner),
204-
body=body_content)
199+
response, content = self.http.request(
200+
path, 'POST', headers=minimal_task_headers(task_owner),
201+
body=body_content)
205202
self.assertEqual(response.status, 400)
206203

207204
# 1. POST /tasks
@@ -212,10 +209,9 @@ def test_create_new_task(self):
212209
body_content = json.dumps(task_data)
213210

214211
path = "/v2/tasks"
215-
response, content = self.http.request(path, 'POST',
216-
headers=
217-
minimal_task_headers(task_owner),
218-
body=body_content)
212+
response, content = self.http.request(
213+
path, 'POST', headers=minimal_task_headers(task_owner),
214+
body=body_content)
219215
self.assertEqual(response.status, 400)
220216

221217
def test_tasks_with_filter(self):
@@ -513,10 +509,9 @@ def test_delete_task(self):
513509
body_content = json.dumps(task_data)
514510

515511
path = "/v2/tasks"
516-
response, content = self.http.request(path, 'POST',
517-
headers=
518-
minimal_task_headers(task_owner),
519-
body=body_content)
512+
response, content = self.http.request(
513+
path, 'POST', headers=minimal_task_headers(task_owner),
514+
body=body_content)
520515
self.assertEqual(response.status, 201)
521516

522517
data = json.loads(content)

glance/tests/unit/test_cinder_store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def test_cinder_configure_add(self):
4848
store = cinder.Store(context=FakeObject(service_catalog=None))
4949
self.assertRaises(exception.BadStoreConfiguration,
5050
store.configure_add)
51-
store = cinder.Store(context=FakeObject(service_catalog=
52-
'fake_service_catalog'))
51+
store = cinder.Store(context=FakeObject(
52+
service_catalog='fake_service_catalog'))
5353
store.configure_add()
5454

5555
def test_cinder_get_size(self):

0 commit comments

Comments
 (0)