Skip to content

Commit 11843f2

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix pep8 errors with new hacking"
2 parents c96ff39 + faa1e64 commit 11843f2

File tree

18 files changed

+66
-63
lines changed

18 files changed

+66
-63
lines changed

nova/api/openstack/wsgi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,9 @@ def wrapped(*args, **kwargs):
694694

695695
LOG.exception("Unexpected exception in API method")
696696
msg = _("Unexpected API Error. "
697-
"%(support)s\n%(exc)s" % {
698-
'support': version.support_string(),
699-
'exc': type(exc)})
697+
"{support}\n{exc}").format(
698+
support=version.support_string(),
699+
exc=type(exc))
700700
raise webob.exc.HTTPInternalServerError(explanation=msg)
701701

702702
return wrapped

nova/cmd/manage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,7 +2624,7 @@ def _check_orphaned_allocations_for_provider(self, ctxt, placement,
26242624
# By default we suspect the orphaned allocation was for a
26252625
# migration...
26262626
consumer_type = 'migration'
2627-
if not(consumer_uuid in inst_uuids):
2627+
if consumer_uuid not in inst_uuids:
26282628
# ... but if we can't find it either for an instance,
26292629
# that means it was for this.
26302630
consumer_type = 'instance'
@@ -2798,8 +2798,8 @@ def get_machine_type(self, instance_uuid=None):
27982798
print(mtype)
27992799
return 0
28002800
else:
2801-
print(_('No machine type registered for instance %s' %
2802-
instance_uuid))
2801+
print(_('No machine type registered for instance %s') %
2802+
instance_uuid)
28032803
return 3
28042804
except (exception.InstanceNotFound,
28052805
exception.InstanceMappingNotFound) as e:

nova/compute/provider_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,9 @@ def _load_yaml_file(path):
229229
if hasattr(ex, 'problem_mark'):
230230
pos = ex.problem_mark
231231
message += _("File: %s ") % open_file.name
232-
message += _("Error position: (%s:%s)") % (
233-
pos.line + 1, pos.column + 1)
232+
message += _("Error position: "
233+
"({line}:{column})").format(
234+
line=pos.line + 1, column=pos.column + 1)
234235
raise nova_exc.ProviderConfigException(error=message)
235236
except OSError:
236237
message = _("Unable to read yaml config file: %s") % path

nova/console/rfb/authvencrypt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ def recv(num):
110110
# MITM'd Anonymous Diffie Hellmann (DH) cyphers)
111111
if AuthVeNCryptSubtype.X509NONE not in sub_types:
112112
reason = _(
113-
"Server does not support the %d (%s) VeNCrypt auth subtype"
114-
) % (
115-
AuthVeNCryptSubtype.X509NONE.value,
116-
AuthVeNCryptSubtype.X509NONE.name)
113+
"Server does not support the {value} ({name}) "
114+
"VeNCrypt auth subtype"
115+
).format(value=AuthVeNCryptSubtype.X509NONE.value,
116+
name=AuthVeNCryptSubtype.X509NONE.name)
117117
raise exception.RFBAuthHandshakeFailed(reason=reason)
118118

119119
LOG.debug(

nova/console/securityproxy/rfb.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,17 @@ def recv(sock, num):
164164
if client_auth != auth.AuthType.NONE:
165165
self._fail(
166166
tenant_sock, compute_sock,
167-
_("Only the security type %d (%s) is supported") % (
168-
auth.AuthType.NONE.value, auth.AuthType.NONE.name,
169-
))
167+
_("Only the security type {value} ({name}) "
168+
"is supported").format(value=auth.AuthType.NONE.value,
169+
name=auth.AuthType.NONE.name))
170170

171171
reason = _(
172-
"Client requested a security type other than %d (%s): "
173-
"%d (%s)"
174-
) % (
175-
auth.AuthType.NONE.value,
176-
auth.AuthType.NONE.name,
177-
auth.AuthType(client_auth).value,
178-
auth.AuthType(client_auth).name,
179-
)
172+
"Client requested a security type other than "
173+
"{value} ({name}): {client_value} ({client_name})"
174+
).format(value=auth.AuthType.NONE.value,
175+
name=auth.AuthType.NONE.name,
176+
client_value=auth.AuthType(client_auth).value,
177+
client_name=auth.AuthType(client_auth).name)
180178
raise exception.SecurityProxyNegotiationFailed(reason=reason)
181179

182180
try:

nova/image/glance.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ def download(self, context, image_id, data=None, dst_path=None,
389389

390390
def _verify_and_write(self, context, image_id, trusted_certs,
391391
image_chunks, data, dst_path):
392-
"""Perform image signature verification and save the image file if needed.
392+
"""Perform image signature verification and save the image file if
393+
needed.
393394
394395
This function writes the content of the image_chunks iterator either to
395396
a file object provided by the data parameter or to a filepath provided

nova/objects/aggregate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def _get_by_host_from_db(context, host, key=None):
437437

438438
@api_db_api.context_manager.reader
439439
def _get_by_metadata_from_db(context, key=None, value=None):
440-
assert(key is not None or value is not None)
440+
assert key is not None or value is not None
441441
query = context.session.query(api_models.Aggregate)
442442
query = query.join(api_models.Aggregate._metadata)
443443
if key is not None:

nova/objects/block_device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _create_uuid(context, bdm_id):
168168
# gave this bdm a uuid
169169
result = query.one()
170170
uuid = result['uuid']
171-
assert(uuid is not None)
171+
assert uuid is not None
172172

173173
return uuid
174174

nova/objects/instance_numa.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ def obj_make_compatible(self, primitive, target_version):
4949
raise exception.ObjectActionError(
5050
action='obj_make_compatible',
5151
reason=_(
52-
'%s policy is not supported in version %s'
53-
) % (primitive['cpu_policy'], target_version))
52+
'{policy} policy is not supported in '
53+
'version {version}'
54+
).format(policy=primitive['cpu_policy'],
55+
version=target_version))
5456

5557
# NOTE(huaqiang): Since version 1.5, 'cpuset' is modified to track the
5658
# unpinned CPUs only, with pinned CPUs tracked via 'pcpuset' instead.

nova/scheduler/filters/image_props_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def _compare_props(props, other_props):
8282

8383
def _compare_product_version(hyper_version, image_props):
8484
version_required = image_props.get('img_hv_requested_version')
85-
if not(hypervisor_version and version_required):
85+
if not (hypervisor_version and version_required):
8686
return True
8787
img_prop_predicate = versionpredicate.VersionPredicate(
8888
'image_prop (%s)' % version_required)

0 commit comments

Comments
 (0)