Move string expansion outside localisation (H702)
String expansion should be done outside localisation call (_()), otherwise there will never be a matching string found in the catalogue. Also enable gating on this Hacking check (H702). Change-Id: Ie7c89fbfb52629e75d5e68e9afda8bcf50bf4cdd
This commit is contained in:
@@ -119,9 +119,9 @@ class ContainerController(object):
|
|||||||
# but if there is, we want to know about it.
|
# but if there is, we want to know about it.
|
||||||
self.logger.error(_('ERROR Account update failed: different '
|
self.logger.error(_('ERROR Account update failed: different '
|
||||||
'numbers of hosts and devices in request: '
|
'numbers of hosts and devices in request: '
|
||||||
'"%s" vs "%s"' %
|
'"%s" vs "%s"') %
|
||||||
(req.headers.get('X-Account-Host', ''),
|
(req.headers.get('X-Account-Host', ''),
|
||||||
req.headers.get('X-Account-Device', ''))))
|
req.headers.get('X-Account-Device', '')))
|
||||||
return HTTPBadRequest(req=req)
|
return HTTPBadRequest(req=req)
|
||||||
|
|
||||||
if account_partition:
|
if account_partition:
|
||||||
|
@@ -194,9 +194,9 @@ class ObjectController(object):
|
|||||||
# but if there is, we want to know about it.
|
# but if there is, we want to know about it.
|
||||||
self.logger.error(_('ERROR Container update failed: different '
|
self.logger.error(_('ERROR Container update failed: different '
|
||||||
'numbers of hosts and devices in request: '
|
'numbers of hosts and devices in request: '
|
||||||
'"%s" vs "%s"' %
|
'"%s" vs "%s"') %
|
||||||
(headers_in.get('X-Container-Host', ''),
|
(headers_in.get('X-Container-Host', ''),
|
||||||
headers_in.get('X-Container-Device', ''))))
|
headers_in.get('X-Container-Device', '')))
|
||||||
return
|
return
|
||||||
|
|
||||||
if contpartition:
|
if contpartition:
|
||||||
|
@@ -217,24 +217,24 @@ class SegmentedIterable(object):
|
|||||||
if sub_etag != self.segment_dict['hash']:
|
if sub_etag != self.segment_dict['hash']:
|
||||||
raise SegmentError(_(
|
raise SegmentError(_(
|
||||||
'Object segment does not match sub-slo: '
|
'Object segment does not match sub-slo: '
|
||||||
'%(path)s etag: %(r_etag)s != %(s_etag)s.' %
|
'%(path)s etag: %(r_etag)s != %(s_etag)s.') %
|
||||||
{'path': path, 'r_etag': sub_etag,
|
{'path': path, 'r_etag': sub_etag,
|
||||||
's_etag': self.segment_dict['hash']}))
|
's_etag': self.segment_dict['hash']})
|
||||||
return self._load_next_segment()
|
return self._load_next_segment()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise SegmentError(_(
|
raise SegmentError(_(
|
||||||
'Sub SLO has invalid manifest: %s' % path))
|
'Sub SLO has invalid manifest: %s') % path)
|
||||||
|
|
||||||
elif resp.etag != self.segment_dict['hash'] or \
|
elif resp.etag != self.segment_dict['hash'] or \
|
||||||
resp.content_length != self.segment_dict['bytes']:
|
resp.content_length != self.segment_dict['bytes']:
|
||||||
raise SegmentError(_(
|
raise SegmentError(_(
|
||||||
'Object segment no longer valid: '
|
'Object segment no longer valid: '
|
||||||
'%(path)s etag: %(r_etag)s != %(s_etag)s or '
|
'%(path)s etag: %(r_etag)s != %(s_etag)s or '
|
||||||
'%(r_size)s != %(s_size)s.' %
|
'%(r_size)s != %(s_size)s.') %
|
||||||
{'path': path, 'r_etag': resp.etag,
|
{'path': path, 'r_etag': resp.etag,
|
||||||
'r_size': resp.content_length,
|
'r_size': resp.content_length,
|
||||||
's_etag': self.segment_dict['hash'],
|
's_etag': self.segment_dict['hash'],
|
||||||
's_size': self.segment_dict['bytes']}))
|
's_size': self.segment_dict['bytes']})
|
||||||
self.segment_iter = resp.app_iter
|
self.segment_iter = resp.app_iter
|
||||||
# See NOTE: swift_conn at top of file about this.
|
# See NOTE: swift_conn at top of file about this.
|
||||||
self.segment_iter_swift_conn = getattr(resp, 'swift_conn', None)
|
self.segment_iter_swift_conn = getattr(resp, 'swift_conn', None)
|
||||||
|
4
tox.ini
4
tox.ini
@@ -28,6 +28,8 @@ commands =
|
|||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore = H203,H301,H302,H306,H402,H404,H702,H703
|
# TODO(dmllr): Review some of the hacking warnings and fix if applicable
|
||||||
|
# H233 Use print function, not print operator
|
||||||
|
ignore = H203,H233,H301,H302,H306,H402,H404,H703
|
||||||
exclude = .venv,.tox,dist,doc,*egg
|
exclude = .venv,.tox,dist,doc,*egg
|
||||||
show-source = True
|
show-source = True
|
||||||
|
Reference in New Issue
Block a user