Clean up pep8 E124 violations

Fixed E124 errors
All other ignores are to be removed in the next sequence of patches

Change-Id: Ic96ebf5dff645dfdc47478beeb6965d6ad266243
This commit is contained in:
Zhongyue Luo 2012-09-19 17:01:13 +08:00
parent 8a8b01174c
commit 305a9c12b5
12 changed files with 100 additions and 85 deletions

View File

@ -29,8 +29,7 @@ from webob.exc import (HTTPError,
HTTPBadRequest,
HTTPForbidden,
HTTPRequestEntityTooLarge,
HTTPServiceUnavailable,
)
HTTPServiceUnavailable)
from glance.api import common
from glance.api import policy

View File

@ -45,7 +45,8 @@ class RequestContext(object):
def to_dict(self):
# NOTE(ameade): These keys are named to correspond with the default
# format string for logging the context in openstack common
return {'request_id': self.request_id,
return {
'request_id': self.request_id,
'user_id': self.user,
'tenant_id': self.tenant,
'is_admin': self.is_admin,

View File

@ -107,8 +107,7 @@ def get_client(host, port=None, timeout=None, use_ssl=False, username=None,
auth_url=auth_url or os.getenv('OS_AUTH_URL'),
strategy=force_strategy or auth_strategy or
os.getenv('OS_AUTH_STRATEGY', 'noauth'),
region=region or os.getenv('OS_REGION_NAME'),
)
region=region or os.getenv('OS_REGION_NAME'))
if creds['strategy'] == 'keystone' and not creds['auth_url']:
msg = ("--os_auth_url option or OS_AUTH_URL environment variable "

View File

@ -30,7 +30,8 @@ LOG = logging.getLogger(__name__)
store_opts = [
cfg.ListOpt('known_stores',
default=['glance.store.filesystem.Store',
default=[
'glance.store.filesystem.Store',
'glance.store.http.Store',
'glance.store.rbd.Store',
'glance.store.s3.Store',

View File

@ -269,7 +269,8 @@ class BaseTestCase(object):
def test_image_get_all_size_min_max(self):
images = self.db_api.image_get_all(self.context,
filters={'size_min': 10,
filters={
'size_min': 10,
'size_max': 15,
})
self.assertEquals(len(images), 1)

View File

@ -498,16 +498,20 @@ class TestEndpoints(utils.BaseTestCase):
def setUp(self):
self.service_catalog = [
{'endpoint_links': [],
{
'endpoint_links': [],
'endpoints': [
{'adminURL': 'http://localhost:8080/',
{
'adminURL': 'http://localhost:8080/',
'region': 'RegionOne',
'internalURL': 'http://internalURL/',
'publicURL': 'http://publicURL/'},
'publicURL': 'http://publicURL/',
},
],
'type': 'object-store',
'name': 'Object Storage Service',
}]
}
]
def test_get_endpoint_with_custom_server_type(self):
endpoint = auth.get_endpoint(self.service_catalog,

View File

@ -884,7 +884,8 @@ class TestRegistryClient(base.IsolatedUnitTest):
def test_add_image_basic(self):
"""Tests that we can add image metadata and returns the new id"""
fixture = {'name': 'fake public image',
fixture = {
'name': 'fake public image',
'is_public': True,
'disk_format': 'vmdk',
'container_format': 'ovf',
@ -925,7 +926,8 @@ class TestRegistryClient(base.IsolatedUnitTest):
def test_add_image_already_exists(self):
"""Tests proper exception is raised if image with ID already exists"""
fixture = {'id': UUID2,
fixture = {
'id': UUID2,
'name': 'fake public image',
'is_public': True,
'disk_format': 'vmdk',
@ -940,7 +942,8 @@ class TestRegistryClient(base.IsolatedUnitTest):
def test_add_image_with_bad_status(self):
"""Tests proper exception is raised if a bad status is set"""
fixture = {'name': 'fake public image',
fixture = {
'name': 'fake public image',
'is_public': True,
'disk_format': 'vmdk',
'container_format': 'ovf',
@ -968,7 +971,8 @@ class TestRegistryClient(base.IsolatedUnitTest):
def test_update_image_not_existing(self):
"""Tests non existing image update doesn't work"""
fixture = {'name': 'fake public image',
fixture = {
'name': 'fake public image',
'is_public': True,
'disk_format': 'vmdk',
'container_format': 'ovf',

View File

@ -137,8 +137,7 @@ class TestMigrations(utils.BaseTestCase):
"|| tablename || ' cascade;' "
"from pg_tables where schemaname = 'public';\" | "
"psql -d %(database)s | grep '^\s*drop' | "
"psql -d %(database)s"
) % locals()
"psql -d %(database)s") % locals()
exitcode, out, err = utils.execute(cmd)
self.assertEqual(0, exitcode)

View File

@ -61,7 +61,8 @@ class TestImagesController(base.StoreClearingUnitTest):
self.assertEqual(4, output['meta']['size'])
self.assertEqual('YYYY', output['data'])
output_log = self.notifier.get_log()
expected_log = {'notification_type': "INFO",
expected_log = {
'notification_type': "INFO",
'event_type': "image.upload",
'payload': output['meta'],
}

View File

@ -328,7 +328,8 @@ class TestImagesController(test_utils.BaseTestCase):
self.assertEqual([], output['tags'])
self.assertEqual(False, output['is_public'])
output_log = self.notifier.get_log()
expected_log = {'notification_type': "INFO",
expected_log = {
'notification_type': "INFO",
'event_type': "image.update",
'payload': output,
}
@ -340,7 +341,8 @@ class TestImagesController(test_utils.BaseTestCase):
output = self.controller.create(request, image)
self.assertEqual(True, output['is_public'])
output_log = self.notifier.get_log()
expected_log = {'notification_type': "INFO",
expected_log = {
'notification_type': "INFO",
'event_type': "image.update",
'payload': output,
}
@ -352,7 +354,8 @@ class TestImagesController(test_utils.BaseTestCase):
output = self.controller.create(request, image)
self.assertEqual(['ping'], output['tags'])
output_log = self.notifier.get_log()
expected_log = {'notification_type': "INFO",
expected_log = {
'notification_type': "INFO",
'event_type': "image.update",
'payload': output,
}
@ -365,7 +368,8 @@ class TestImagesController(test_utils.BaseTestCase):
self.assertEqual(output['created_at'], output['updated_at'])
self.assertTrue('tags' in output)
output_log = self.notifier.get_log()
expected_log = {'notification_type': "INFO",
expected_log = {
'notification_type': "INFO",
'event_type': "image.update",
'payload': output,
}
@ -525,7 +529,8 @@ class TestImagesController(test_utils.BaseTestCase):
output = self.controller.update(request, UUID1, changes)
self.assertEqual(['ping'], output['tags'])
output_log = self.notifier.get_log()
expected_log = {'notification_type': "INFO",
expected_log = {
'notification_type': "INFO",
'event_type': "image.update",
'payload': output,
}

View File

@ -328,7 +328,8 @@ def xattr_writes_supported(path):
def minimal_headers(name, public=True):
headers = {'Content-Type': 'application/octet-stream',
headers = {
'Content-Type': 'application/octet-stream',
'X-Image-Meta-Name': name,
'X-Image-Meta-disk_format': 'raw',
'X-Image-Meta-container_format': 'ovf',

View File

@ -18,7 +18,7 @@ downloadcache = ~/cache/pip
[testenv:pep8]
deps = pep8==1.3.3
commands = pep8 --ignore=E124,E125,E126,E127,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack .
commands = pep8 --ignore=E125,E126,E127,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack .
[testenv:cover]
setenv = NOSE_WITH_COVERAGE=1