Fix pep8 issues

Fixing pep8 issues for flake8 release 3.8.0:
 - E741 (ambiguous variable name)
 - E225 (missing whitespace around operator)

Change-Id: I23c8a07d6ab8745bd3d32922b24920bde2f9eeb8
This commit is contained in:
Douglas Viroel 2020-05-12 11:20:20 -03:00
parent 79784bac42
commit 9fbde73868
5 changed files with 13 additions and 13 deletions

View File

@ -3243,7 +3243,7 @@ def share_export_locations_update(context, share_instance_id, export_locations,
context, share_instance_id, session=session)
def get_path_list_from_rows(rows):
return set([l['path'] for l in rows])
return set([row['path'] for row in rows])
current_el_paths = get_path_list_from_rows(current_el_rows)

View File

@ -117,7 +117,7 @@ class IPWrapper(SubProcessBase):
@classmethod
def get_namespaces(cls):
output = cls._execute('', 'netns', ('list',))
return [l.strip() for l in output.split('\n')]
return [ns.strip() for ns in output.split('\n')]
class IPDevice(SubProcessBase):

View File

@ -165,23 +165,23 @@ def parseconf(conf):
Convert config to a (nested) dictionary.
"""
def list_to_dict(l):
def list_to_dict(src_list):
# Convert a list of key-value pairs stored as tuples to a dict.
# For tuples with identical keys, preserve all the values in a
# list. e.g., argument [('k', 'v1'), ('k', 'v2')] to function
# returns {'k': ['v1', 'v2']}.
d = {}
for i in l:
dst_dict = {}
for i in src_list:
if isinstance(i, tuple):
k, v = i
if isinstance(v, list):
v = list_to_dict(v)
if k in d:
d[k] = [d[k]]
d[k].append(v)
if k in dst_dict:
dst_dict[k] = [dst_dict[k]]
dst_dict[k].append(v)
else:
d[k] = v
return d
dst_dict[k] = v
return dst_dict
try:
# allow config to be specified in JSON --

View File

@ -96,8 +96,8 @@ class NetAppBaseClient(object):
LOG.exception("Could not get licenses list.")
return sorted(
[l.get_child_content('package').lower()
for l in result.get_child_by_name('licenses').get_children()])
[child.get_child_content('package').lower()
for child in result.get_child_by_name('licenses').get_children()])
def send_ems_log_message(self, message_dict):
"""Sends a message to the Data ONTAP EMS log."""

View File

@ -1441,7 +1441,7 @@ class ShareManagerTestCase(test.TestCase):
mock_replica_update = self.mock_object(db, 'share_replica_update')
expected_update_calls = [mock.call(
mock.ANY, r['id'], {'status': constants.STATUS_ERROR})
for r in(replica, active_replica)]
for r in (replica, active_replica)]
self.assertRaises(exception.ManilaException,
self.share_manager.promote_share_replica,