Fix pep8 E warning for hacking 0.10
Fix pep8 warnings of the E category of hacking 0.10: * E113: unexpected indentation * E121: continuation line under-indented for hanging indent * E122: continuation line missing indentation or outdented * E123: closing bracket does not match indentation of opening bracket's line * E126: continuation line over-indented for hanging indent * E251: unexpected spaces around keyword / parameter equals Change-Id: I0b24eebdf1a37dc1b572b6c9a3d3d4832d050237
This commit is contained in:
parent
d719064e78
commit
389a97e352
@ -122,11 +122,10 @@ class AccountAuditor(Daemon):
|
||||
continue
|
||||
raise InvalidAccountInfo(_(
|
||||
'The total %(key)s for the container (%(total)s) does not '
|
||||
'match the sum of %(key)s across policies (%(sum)s)') % {
|
||||
'key': key,
|
||||
'total': info[key],
|
||||
'sum': policy_totals[key],
|
||||
})
|
||||
'match the sum of %(key)s across policies (%(sum)s)')
|
||||
% {'key': key,
|
||||
'total': info[key],
|
||||
'sum': policy_totals[key]})
|
||||
|
||||
def account_audit(self, path):
|
||||
"""
|
||||
|
@ -543,8 +543,8 @@ def retry(func, *args, **kwargs):
|
||||
# Shouldn't actually get down here, but just in case.
|
||||
if args and 'ip' in args[0]:
|
||||
raise ClientException('Raise too many retries',
|
||||
http_host=args[
|
||||
0]['ip'], http_port=args[0]['port'],
|
||||
http_host=args[0]['ip'],
|
||||
http_port=args[0]['port'],
|
||||
http_device=args[0]['device'])
|
||||
else:
|
||||
raise ClientException('Raise too many retries')
|
||||
|
@ -674,15 +674,15 @@ class TempAuth(object):
|
||||
user = req.headers.get('x-auth-user')
|
||||
if not user or ':' not in user:
|
||||
self.logger.increment('token_denied')
|
||||
return HTTPUnauthorized(request=req, headers=
|
||||
{'Www-Authenticate':
|
||||
'Swift realm="%s"' % account})
|
||||
auth = 'Swift realm="%s"' % account
|
||||
return HTTPUnauthorized(request=req,
|
||||
headers={'Www-Authenticate': auth})
|
||||
account2, user = user.split(':', 1)
|
||||
if account != account2:
|
||||
self.logger.increment('token_denied')
|
||||
return HTTPUnauthorized(request=req, headers=
|
||||
{'Www-Authenticate':
|
||||
'Swift realm="%s"' % account})
|
||||
auth = 'Swift realm="%s"' % account
|
||||
return HTTPUnauthorized(request=req,
|
||||
headers={'Www-Authenticate': auth})
|
||||
key = req.headers.get('x-storage-pass')
|
||||
if not key:
|
||||
key = req.headers.get('x-auth-key')
|
||||
@ -692,9 +692,9 @@ class TempAuth(object):
|
||||
user = req.headers.get('x-storage-user')
|
||||
if not user or ':' not in user:
|
||||
self.logger.increment('token_denied')
|
||||
return HTTPUnauthorized(request=req, headers=
|
||||
{'Www-Authenticate':
|
||||
'Swift realm="unknown"'})
|
||||
auth = 'Swift realm="unknown"'
|
||||
return HTTPUnauthorized(request=req,
|
||||
headers={'Www-Authenticate': auth})
|
||||
account, user = user.split(':', 1)
|
||||
key = req.headers.get('x-auth-key')
|
||||
if not key:
|
||||
@ -711,14 +711,14 @@ class TempAuth(object):
|
||||
account_user = account + ':' + user
|
||||
if account_user not in self.users:
|
||||
self.logger.increment('token_denied')
|
||||
return HTTPUnauthorized(request=req, headers=
|
||||
{'Www-Authenticate':
|
||||
'Swift realm="%s"' % account})
|
||||
auth = 'Swift realm="%s"' % account
|
||||
return HTTPUnauthorized(request=req,
|
||||
headers={'Www-Authenticate': auth})
|
||||
if self.users[account_user]['key'] != key:
|
||||
self.logger.increment('token_denied')
|
||||
return HTTPUnauthorized(request=req, headers=
|
||||
{'Www-Authenticate':
|
||||
'Swift realm="unknown"'})
|
||||
auth = 'Swift realm="unknown"'
|
||||
return HTTPUnauthorized(request=req,
|
||||
headers={'Www-Authenticate': auth})
|
||||
account_id = self.users[account_user]['url'].rsplit('/', 1)[-1]
|
||||
# Get memcache client
|
||||
memcache_client = cache_from_env(req.environ)
|
||||
|
@ -319,11 +319,11 @@ class ObjectReconstructor(Daemon):
|
||||
except (Exception, Timeout):
|
||||
self.logger.exception(
|
||||
_("Error trying to rebuild %(path)s "
|
||||
"policy#%(policy)d frag#%(frag_index)s"), {
|
||||
'path': path,
|
||||
'policy': policy,
|
||||
'frag_index': frag_index,
|
||||
})
|
||||
"policy#%(policy)d frag#%(frag_index)s"),
|
||||
{'path': path,
|
||||
'policy': policy,
|
||||
'frag_index': frag_index,
|
||||
})
|
||||
break
|
||||
if not all(fragment_payload):
|
||||
break
|
||||
@ -486,14 +486,11 @@ class ObjectReconstructor(Daemon):
|
||||
self._full_path(node, job['partition'], '',
|
||||
job['policy']))
|
||||
elif resp.status != HTTP_OK:
|
||||
full_path = self._full_path(node, job['partition'], '',
|
||||
job['policy'])
|
||||
self.logger.error(
|
||||
_("Invalid response %(resp)s "
|
||||
"from %(full_path)s"), {
|
||||
'resp': resp.status,
|
||||
'full_path': self._full_path(
|
||||
node, job['partition'], '',
|
||||
job['policy'])
|
||||
})
|
||||
_("Invalid response %(resp)s from %(full_path)s"),
|
||||
{'resp': resp.status, 'full_path': full_path})
|
||||
else:
|
||||
remote_suffixes = pickle.loads(resp.read())
|
||||
except (Exception, Timeout):
|
||||
|
@ -569,11 +569,11 @@ class Application(object):
|
||||
else:
|
||||
log = self.logger.exception
|
||||
log(_('ERROR with %(type)s server %(ip)s:%(port)s/%(device)s'
|
||||
' re: %(info)s'), {
|
||||
'type': typ, 'ip': node['ip'], 'port':
|
||||
node['port'], 'device': node['device'],
|
||||
'info': additional_info
|
||||
}, **kwargs)
|
||||
' re: %(info)s'),
|
||||
{'type': typ, 'ip': node['ip'],
|
||||
'port': node['port'], 'device': node['device'],
|
||||
'info': additional_info},
|
||||
**kwargs)
|
||||
|
||||
def modify_wsgi_pipeline(self, pipe):
|
||||
"""
|
||||
|
@ -940,9 +940,9 @@ class TestContainerController(unittest.TestCase):
|
||||
snowman = u'\u2603'
|
||||
container_name = snowman.encode('utf-8')
|
||||
req = Request.blank(
|
||||
'/sda1/p/a/%s' % container_name, environ={
|
||||
'REQUEST_METHOD': 'PUT',
|
||||
'HTTP_X_TIMESTAMP': '1'})
|
||||
'/sda1/p/a/%s' % container_name,
|
||||
environ={'REQUEST_METHOD': 'PUT',
|
||||
'HTTP_X_TIMESTAMP': '1'})
|
||||
resp = req.get_response(self.controller)
|
||||
self.assertEquals(resp.status_int, 201)
|
||||
|
||||
|
@ -2240,12 +2240,11 @@ class TestObjectController(unittest.TestCase):
|
||||
self.assertEquals(len(os.listdir(os.path.dirname(ts_1000_file))), 1)
|
||||
|
||||
orig_timestamp = utils.Timestamp(1002).internal
|
||||
headers = {'X-Timestamp': orig_timestamp,
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'Content-Length': '4'}
|
||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||
headers={
|
||||
'X-Timestamp': orig_timestamp,
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'Content-Length': '4',
|
||||
})
|
||||
headers=headers)
|
||||
req.body = 'test'
|
||||
resp = req.get_response(self.object_controller)
|
||||
self.assertEquals(resp.status_int, 201)
|
||||
@ -2295,12 +2294,11 @@ class TestObjectController(unittest.TestCase):
|
||||
# state.
|
||||
start = time()
|
||||
orig_timestamp = utils.Timestamp(start)
|
||||
headers = {'X-Timestamp': orig_timestamp.internal,
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'Content-Length': '4'}
|
||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||
headers={
|
||||
'X-Timestamp': orig_timestamp.internal,
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'Content-Length': '4',
|
||||
})
|
||||
headers=headers)
|
||||
req.body = 'test'
|
||||
resp = req.get_response(self.object_controller)
|
||||
self.assertEquals(resp.status_int, 201)
|
||||
|
@ -5763,11 +5763,10 @@ class TestObjectController(unittest.TestCase):
|
||||
self.assertEquals(resp.status_int // 100, 5) # server error
|
||||
|
||||
# req supplies etag, object servers return 422 - mismatch
|
||||
headers = {'Content-Length': '0',
|
||||
'ETag': '68b329da9893e34099c7d8ad5cb9c940'}
|
||||
req = Request.blank('/v1/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||
headers={
|
||||
'Content-Length': '0',
|
||||
'ETag': '68b329da9893e34099c7d8ad5cb9c940',
|
||||
})
|
||||
headers=headers)
|
||||
self.app.update_request(req)
|
||||
set_http_connect(200, 422, 422, 503,
|
||||
etags=['68b329da9893e34099c7d8ad5cb9c940',
|
||||
@ -8499,7 +8498,7 @@ class TestAccountController(unittest.TestCase):
|
||||
self.assert_status_map(
|
||||
controller.POST,
|
||||
(404, 404, 404, 202, 202, 202, 201, 201, 201), 201)
|
||||
# account_info PUT account POST account
|
||||
# account_info PUT account POST account
|
||||
self.assert_status_map(
|
||||
controller.POST,
|
||||
(404, 404, 503, 201, 201, 503, 204, 204, 504), 204)
|
||||
|
Loading…
Reference in New Issue
Block a user