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
This commit is contained in:
parent
182594ed76
commit
27391d1915
|
@ -134,10 +134,10 @@ def upload_data_to_store(req, image_meta, image_data, store, notifier):
|
|||
# Update the database with the checksum returned
|
||||
# from the backend store
|
||||
LOG.debug(_("Updating image %(image_id)s data. "
|
||||
"Checksum set to %(checksum)s, size set "
|
||||
"to %(size)d"), {'image_id': image_id,
|
||||
'checksum': checksum,
|
||||
'size': size})
|
||||
"Checksum set to %(checksum)s, size set "
|
||||
"to %(size)d"), {'image_id': image_id,
|
||||
'checksum': checksum,
|
||||
'size': size})
|
||||
update_data = {'checksum': checksum,
|
||||
'size': size}
|
||||
try:
|
||||
|
|
|
@ -153,7 +153,7 @@ class ImageService(object):
|
|||
response = self._http_request('GET', url, {}, '')
|
||||
result = jsonutils.loads(response.read())
|
||||
|
||||
if not result or not 'images' in result or not result['images']:
|
||||
if not result or 'images' not in result or not result['images']:
|
||||
return
|
||||
for image in result.get('images', []):
|
||||
params['marker'] = image['id']
|
||||
|
@ -372,8 +372,8 @@ def _dict_diff(a, b):
|
|||
for key in a:
|
||||
if str(a[key]) != str(b[key]):
|
||||
logging.debug(_('metadata diff -- value differs for key '
|
||||
'%(key)s: master "%(master_value)s" vs '
|
||||
'slave "%(slave_value)s"') %
|
||||
'%(key)s: master "%(master_value)s" vs '
|
||||
'slave "%(slave_value)s"') %
|
||||
{'key': key, 'master_value': a[key],
|
||||
'slave_value': b[key]})
|
||||
return True
|
||||
|
@ -594,8 +594,8 @@ def replication_compare(options, args):
|
|||
for key in image:
|
||||
if image[key] != headers.get(key, None):
|
||||
logging.info(_('%(image_id)s: field %(key)s differs '
|
||||
'(source is %(master_value)s, destination '
|
||||
'is %(slave_value)s)')
|
||||
'(source is %(master_value)s, destination '
|
||||
'is %(slave_value)s)')
|
||||
% {'image_id': image['id'],
|
||||
'key': key,
|
||||
'master_value': image[key],
|
||||
|
|
|
@ -358,7 +358,7 @@ class TestApi(functional.FunctionalTest):
|
|||
# 16. Attempt to replace members with an overlimit amount
|
||||
# Adding 11 image members should fail since configured limit is 10
|
||||
path = ("http://%s:%d/v1/images/%s/members" %
|
||||
("127.0.0.1", self.api_port, image_id))
|
||||
("127.0.0.1", self.api_port, image_id))
|
||||
memberships = []
|
||||
for i in range(11):
|
||||
member_id = "foo%d" % i
|
||||
|
@ -371,7 +371,7 @@ class TestApi(functional.FunctionalTest):
|
|||
# 17. Attempt to add a member while at limit
|
||||
# Adding an 11th member should fail since configured limit is 10
|
||||
path = ("http://%s:%d/v1/images/%s/members" %
|
||||
("127.0.0.1", self.api_port, image_id))
|
||||
("127.0.0.1", self.api_port, image_id))
|
||||
memberships = []
|
||||
for i in range(10):
|
||||
member_id = "foo%d" % i
|
||||
|
@ -382,7 +382,7 @@ class TestApi(functional.FunctionalTest):
|
|||
self.assertEqual(response.status, 204)
|
||||
|
||||
path = ("http://%s:%d/v1/images/%s/members/fail_me" %
|
||||
("127.0.0.1", self.api_port, image_id))
|
||||
("127.0.0.1", self.api_port, image_id))
|
||||
http = httplib2.Http()
|
||||
response, content = http.request(path, 'PUT')
|
||||
self.assertEqual(response.status, 413)
|
||||
|
|
|
@ -2056,7 +2056,7 @@ class TestImageLocationSelectionStrategy(functional.FunctionalTest):
|
|||
self.assertTrue('locations' in image)
|
||||
self.assertTrue(image["locations"] == [])
|
||||
|
||||
# Update image locations via PATCH
|
||||
# Update image locations via PATCH
|
||||
path = self._url('/v2/images/%s' % image_id)
|
||||
media_type = 'application/openstack-images-v2.1-json-patch'
|
||||
headers = self._headers({'content-type': media_type})
|
||||
|
@ -2115,7 +2115,7 @@ class TestImageLocationSelectionStrategy(functional.FunctionalTest):
|
|||
self.assertTrue('locations' in image)
|
||||
self.assertTrue(image["locations"] == [])
|
||||
|
||||
# Update image locations via PATCH
|
||||
# Update image locations via PATCH
|
||||
path = self._url('/v2/images/%s' % image_id)
|
||||
media_type = 'application/openstack-images-v2.1-json-patch'
|
||||
headers = self._headers({'content-type': media_type})
|
||||
|
|
|
@ -97,10 +97,9 @@ class TestTasksApi(base.ApiTest):
|
|||
body_content = json.dumps(task_data)
|
||||
|
||||
path = "/v2/tasks"
|
||||
response, content = self.http.request(path, 'POST',
|
||||
headers=
|
||||
minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
response, content = self.http.request(
|
||||
path, 'POST', headers=minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
self.assertEqual(response.status, 201)
|
||||
|
||||
data = json.loads(content)
|
||||
|
@ -176,10 +175,9 @@ class TestTasksApi(base.ApiTest):
|
|||
body_content = json.dumps(task_data)
|
||||
|
||||
path = "/v2/tasks"
|
||||
response, content = self.http.request(path, 'POST',
|
||||
headers=
|
||||
minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
response, content = self.http.request(
|
||||
path, 'POST', headers=minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
self.assertEqual(response.status, 201)
|
||||
|
||||
data = json.loads(content)
|
||||
|
@ -198,10 +196,9 @@ class TestTasksApi(base.ApiTest):
|
|||
body_content = json.dumps(task_data)
|
||||
|
||||
path = "/v2/tasks"
|
||||
response, content = self.http.request(path, 'POST',
|
||||
headers=
|
||||
minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
response, content = self.http.request(
|
||||
path, 'POST', headers=minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
self.assertEqual(response.status, 400)
|
||||
|
||||
# 1. POST /tasks
|
||||
|
@ -212,10 +209,9 @@ class TestTasksApi(base.ApiTest):
|
|||
body_content = json.dumps(task_data)
|
||||
|
||||
path = "/v2/tasks"
|
||||
response, content = self.http.request(path, 'POST',
|
||||
headers=
|
||||
minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
response, content = self.http.request(
|
||||
path, 'POST', headers=minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
self.assertEqual(response.status, 400)
|
||||
|
||||
def test_tasks_with_filter(self):
|
||||
|
@ -513,10 +509,9 @@ class TestTasksApi(base.ApiTest):
|
|||
body_content = json.dumps(task_data)
|
||||
|
||||
path = "/v2/tasks"
|
||||
response, content = self.http.request(path, 'POST',
|
||||
headers=
|
||||
minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
response, content = self.http.request(
|
||||
path, 'POST', headers=minimal_task_headers(task_owner),
|
||||
body=body_content)
|
||||
self.assertEqual(response.status, 201)
|
||||
|
||||
data = json.loads(content)
|
||||
|
|
|
@ -48,8 +48,8 @@ class TestCinderStore(base.StoreClearingUnitTest):
|
|||
store = cinder.Store(context=FakeObject(service_catalog=None))
|
||||
self.assertRaises(exception.BadStoreConfiguration,
|
||||
store.configure_add)
|
||||
store = cinder.Store(context=FakeObject(service_catalog=
|
||||
'fake_service_catalog'))
|
||||
store = cinder.Store(context=FakeObject(
|
||||
service_catalog='fake_service_catalog'))
|
||||
store.configure_add()
|
||||
|
||||
def test_cinder_get_size(self):
|
||||
|
|
Loading…
Reference in New Issue