diff --git a/glance/api/v1/images.py b/glance/api/v1/images.py index 16a6f4932d..7fc4db2fa3 100644 --- a/glance/api/v1/images.py +++ b/glance/api/v1/images.py @@ -673,9 +673,9 @@ class Controller(controller.BaseController): image_size_store != image_size_meta): msg = _("Provided image size must match the stored " "image size. (provided size: %(ps)d, " - "stored size: %(ss)d)" % - {"ps": image_size_meta, - "ss": image_size_store}) + "stored size: %(ss)d)") % { + "ps": image_size_meta, + "ss": image_size_store} LOG.debug(msg) raise HTTPConflict(explanation=msg, request=req, diff --git a/glance/common/property_utils.py b/glance/common/property_utils.py index dfea56f5df..be0dadcf09 100644 --- a/glance/common/property_utils.py +++ b/glance/common/property_utils.py @@ -76,9 +76,10 @@ class PropertyRules(object): raise exception.InvalidPropertyProtectionConfiguration() if self.prop_prot_rule_format not in ['policies', 'roles']: - msg = _("Invalid value '%s' for 'property_protection_rule_format'" - ". The permitted values are 'roles' and 'policies'" % - self.prop_prot_rule_format) + msg = _("Invalid value '%s' for " + "'property_protection_rule_format'. " + "The permitted values are " + "'roles' and 'policies'") % self.prop_prot_rule_format LOG.error(msg) raise exception.InvalidPropertyProtectionConfiguration() @@ -93,11 +94,11 @@ class PropertyRules(object): if permissions: if self.prop_prot_rule_format == 'policies': if ',' in permissions: - msg = _("Multiple policies '%s' not allowed for a" - " given operation. Policies can be " - "combined in the policy file" % - permissions) - LOG.error(msg) + LOG.error( + _("Multiple policies '%s' not allowed" + "for a given operation. Policies can be " + "combined in the policy file"), + permissions) raise exception.\ InvalidPropertyProtectionConfiguration() self.prop_exp_mapping[compiled_rule] = property_exp @@ -110,11 +111,10 @@ class PropertyRules(object): property_dict[operation] = permissions else: property_dict[operation] = [] - msg = _(('Property protection on operation %s for rule ' - '%s is not found. No role will be allowed to ' - 'perform this operation.' % - (operation, property_exp))) - LOG.warn(msg) + LOG.warn( + _('Property protection on operation %s for rule ' + '%s is not found. No role will be allowed to ' + 'perform this operation.'), operation, property_exp) self.rules.append((compiled_rule, property_dict)) @@ -165,9 +165,9 @@ class PropertyRules(object): rule_roles = rule.get(action) if rule_roles: if '@' in rule_roles and '!' in rule_roles: - msg = _("Malformed property protection rule '%s': '@' " - "and '!' are mutually exclusive" - % property_name) + msg = _( + "Malformed property protection rule '%s': '@' " + "and '!' are mutually exclusive") % property_name LOG.error(msg) raise webob.exc.HTTPInternalServerError(msg) elif '@' in rule_roles: diff --git a/glance/db/__init__.py b/glance/db/__init__.py index 2eb1ef98f6..891a805330 100644 --- a/glance/db/__init__.py +++ b/glance/db/__init__.py @@ -244,9 +244,9 @@ class ImageMemberRepo(object): pass else: msg = _('The target member %(member_id)s is already ' - 'associated with image %(image_id)s.' % - dict(member_id=image_member.member_id, - image_id=self.image.image_id)) + 'associated with image %(image_id)s.') % { + 'member_id': image_member.member_id, + 'image_id': self.image.image_id} raise exception.Duplicate(msg) image_member_values = self._format_image_member_to_db(image_member) diff --git a/glance/store/swift.py b/glance/store/swift.py index 450dbf143a..f51ffed269 100644 --- a/glance/store/swift.py +++ b/glance/store/swift.py @@ -286,7 +286,7 @@ class BaseStore(glance.store.base.Store): resp_chunk_size=self.CHUNKSIZE) except swiftclient.ClientException as e: if e.http_status == httplib.NOT_FOUND: - msg = _("Swift could not find object %s." % location.obj) + msg = _("Swift could not find object %s.") % location.obj LOG.warn(msg) raise exception.NotFound(msg) else: diff --git a/tox.ini b/tox.ini index 50c59d25e4..4932149d1c 100644 --- a/tox.ini +++ b/tox.ini @@ -44,9 +44,7 @@ commands = {posargs} # H306 imports not in alphabetical order # H402 one line docstring needs punctuation. # H404 multi line docstring should start with a summary -# H701 Empty localisation string -# H702 Formatting operation should be outside of localization # H703 multiple positional placeholders -ignore = E125,E126,E711,E712,F811,F821,F841,H102,H201,H202,H233,H301,H302,H306,H402,H404,H701,H702,H703 +ignore = E125,E126,E711,E712,F811,F821,F841,H102,H201,H202,H233,H301,H302,H306,H402,H404,H703 builtins = _ exclude = .venv,.git,.tox,dist,doc,etc,*glance/locale*,*openstack/common*,*lib/python*,*egg,build