Fix some pep8 errors

A new pep8 style library must have been released which
is causing some new errors, E471 among them. Clean-up
on aisle 8.

Change-Id: I153abada74e8c522fe9866a239a36dbb8365a29e
This commit is contained in:
Brian Haley 2020-05-11 18:23:22 -04:00
parent 2ac52607c2
commit 0a4b95eec2
7 changed files with 21 additions and 23 deletions

View File

@ -160,8 +160,8 @@ class FdbPopulationAgentExtension(
self.fdb_tracker.delete_port(devices, port_id)
def _get_devices(self):
def _flatten_list(l):
return [item for sublist in l for item in sublist]
def _flatten_list(li):
return [item for sublist in li for item in sublist]
return _flatten_list(self.device_mappings.values())

View File

@ -879,8 +879,8 @@ class Dnsmasq(DhcpLocalProcess):
leases = set()
try:
with open(filename) as f:
for l in f.readlines():
host = l.strip().split(',')
for line in f.readlines():
host = line.strip().split(',')
mac = host[0]
client_id = None
if host[1].startswith('set:'):
@ -938,10 +938,10 @@ class Dnsmasq(DhcpLocalProcess):
server_id = None
if os.path.exists(filename):
with open(filename) as f:
for l in f.readlines():
if l.startswith('duid'):
for line in f.readlines():
if line.startswith('duid'):
if not server_id:
server_id = l.strip().split()[1]
server_id = line.strip().split()[1]
continue
else:
LOG.warning('Multiple DUID entries in %s '
@ -949,7 +949,7 @@ class Dnsmasq(DhcpLocalProcess):
'not functioning properly',
filename)
continue
parts = l.strip().split()
parts = line.strip().split()
if len(parts) != 5:
LOG.warning('Invalid lease entry %s found in %s '
'lease file, ignoring', parts, filename)

View File

@ -270,7 +270,7 @@ class VlanTypeDriver(helpers.SegmentTypeDriver):
if self.is_partial_segment(segment):
if (directory.get_plugin(
plugin_constants.NETWORK_SEGMENT_RANGE)and project_id):
plugin_constants.NETWORK_SEGMENT_RANGE) and project_id):
filters['project_id'] = project_id
alloc = self.allocate_partially_specified_segment(
context, **filters)

View File

@ -2034,9 +2034,9 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
port_id)
result[dev_id] = None
continue
levels = [l for l in port_db.binding_levels
if l.host == bindlevelhost_match]
levels = sorted(levels, key=lambda l: l.level)
levels = [bl for bl in port_db.binding_levels
if bl.host == bindlevelhost_match]
levels = sorted(levels, key=lambda bl: bl.level)
network_ctx = netctxs_by_netid.get(port_db.network_id)
port_context = driver_context.PortContext(
self, plugin_context, port, network_ctx, binding, levels)

View File

@ -741,13 +741,11 @@ class TestOvnNbSync(base.TestOVNFunctionalBase):
ip_prefix, nexthop,
True))
for lrouter_name, nat_dict in(
self.create_lrouter_nats):
for lrouter_name, nat_dict in self.create_lrouter_nats:
txn.add(self.nb_api.add_nat_rule_in_lrouter(
lrouter_name, **nat_dict))
for lrouter_name, nat_dict in(
self.delete_lrouter_nats):
for lrouter_name, nat_dict in self.delete_lrouter_nats:
txn.add(self.nb_api.delete_nat_rule_in_lrouter(
lrouter_name, if_exists=True, **nat_dict))

View File

@ -1508,7 +1508,7 @@ class TestDnsmasq(TestBase):
'00:00:80:aa:bb:cc 192.168.0.2 * *',
'00:00:0f:aa:bb:cc 192.168.0.3 * *',
'00:00:0f:rr:rr:rr 192.168.0.1 * *\n']
expected = "\n".join(['%s %s' % (timestamp, l) for l in expected])
expected = "\n".join(['%s %s' % (timestamp, le) for le in expected])
with mock.patch.object(dhcp.Dnsmasq, 'get_conf_file_name') as conf_fn:
conf_fn.return_value = '/foo/leases'
dm = self._get_dnsmasq(FakeDualNetwork())

View File

@ -1334,12 +1334,12 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
with self.router(tenant_id=router_tenant_id, set_context=True) as r:
with self.network(shared=True) as n:
with self.subnet(network=n) as s1, (
self.subnet(network=n, cidr='fd00::/64',
ip_version=lib_constants.IP_VERSION_6)
) as s2, (
self.subnet(network=n, cidr='fd01::/64',
ip_version=lib_constants.IP_VERSION_6)
) as s3:
self.subnet(network=n, cidr='fd00::/64',
ip_version=lib_constants.IP_VERSION_6)
) as s2, (
self.subnet(network=n, cidr='fd01::/64',
ip_version=lib_constants.IP_VERSION_6)
) as s3:
fixed_ips = [{'subnet_id': s1['subnet']['id']},
{'subnet_id': s2['subnet']['id']},
{'subnet_id': s3['subnet']['id']}]