diff --git a/neutron/agent/l2/extensions/fdb_population.py b/neutron/agent/l2/extensions/fdb_population.py index 2619a653edc..26980f2137c 100644 --- a/neutron/agent/l2/extensions/fdb_population.py +++ b/neutron/agent/l2/extensions/fdb_population.py @@ -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()) diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index 0f17aa4337e..88af95d9b07 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -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) diff --git a/neutron/plugins/ml2/drivers/type_vlan.py b/neutron/plugins/ml2/drivers/type_vlan.py index 60777f880ff..6d16b05ad45 100644 --- a/neutron/plugins/ml2/drivers/type_vlan.py +++ b/neutron/plugins/ml2/drivers/type_vlan.py @@ -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) diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index 7084c4621be..ef56846d3fd 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -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) diff --git a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_sync.py b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_sync.py index 6a95fc096d1..bd478730214 100644 --- a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_sync.py +++ b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_sync.py @@ -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)) diff --git a/neutron/tests/unit/agent/linux/test_dhcp.py b/neutron/tests/unit/agent/linux/test_dhcp.py index 5ef2aa43bff..d40ce485dc5 100644 --- a/neutron/tests/unit/agent/linux/test_dhcp.py +++ b/neutron/tests/unit/agent/linux/test_dhcp.py @@ -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()) diff --git a/neutron/tests/unit/extensions/test_l3.py b/neutron/tests/unit/extensions/test_l3.py index 4509c860764..a73eefd43ea 100644 --- a/neutron/tests/unit/extensions/test_l3.py +++ b/neutron/tests/unit/extensions/test_l3.py @@ -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']}]