From c3b83a9ca63034ddf54baf9608e8f8cc01f72100 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Mon, 30 Apr 2018 16:35:52 -0400 Subject: [PATCH] Fix all pep8 E265 errors Fixed all pep8 E265 errors and changed tox.ini to no longer ignore them. Also removed an N536 comment missed from a previous change. Change-Id: Ie6db8406c3b884c95b2a54a7598ea83476b8dba1 --- neutron/agent/l2/extensions/qos.py | 6 ++--- neutron/agent/l3/dvr_local_router.py | 4 ++-- neutron/agent/l3/router_info.py | 2 +- neutron/agent/linux/iptables_firewall.py | 8 +++---- neutron/agent/linux/keepalived.py | 2 +- neutron/agent/linux/tc_lib.py | 14 ++++++------ neutron/agent/linux/utils.py | 4 ++-- .../api/rpc/callbacks/consumer/registry.py | 4 ++-- neutron/api/rpc/callbacks/version_manager.py | 2 +- neutron/common/utils.py | 4 ++-- .../conf/extensions/allowedaddresspairs.py | 2 +- neutron/db/agents_db.py | 4 ++-- neutron/db/extraroute_db.py | 6 ++--- neutron/db/l3_db.py | 2 +- ...8bdae39_migrate_neutron_resources_table.py | 2 +- .../contract/97c25b0d2353_add_name_desc.py | 2 +- ...f66e62_add_standardattr_to_qos_policies.py | 2 +- neutron/db/migration/cli.py | 2 +- neutron/db/quota/driver.py | 2 +- neutron/db/standard_attr.py | 2 +- neutron/debug/shell.py | 2 +- neutron/objects/qos/rule.py | 6 ++--- .../ml2/drivers/agent/_common_agent.py | 2 +- .../mech_sriov/agent/eswitch_manager.py | 22 +++++++++---------- .../mech_sriov/agent/sriov_nic_agent.py | 2 +- .../agent/extension_drivers/qos_driver.py | 6 ++--- .../openvswitch/agent/ovs_neutron_agent.py | 8 +++---- neutron/scheduler/dhcp_agent_scheduler.py | 2 +- .../tests/fullstack/resources/environment.py | 10 ++++----- .../functional/agent/test_l2_ovs_agent.py | 6 ++--- .../tests/functional/db/test_migrations.py | 8 +++---- .../agent/linux/test_iptables_firewall.py | 4 ++-- .../unit/agent/test_securitygroups_rpc.py | 4 ++-- .../tests/unit/db/test_db_base_plugin_v2.py | 20 ++++++++--------- neutron/tests/unit/extensions/foxinsocks.py | 4 ++-- neutron/tests/unit/extensions/test_l3.py | 4 ++-- .../unit/extensions/test_securitygroup.py | 6 ++--- .../tests/unit/extensions/test_timestamp.py | 2 +- .../extensions/test_allowedaddresspairs.py | 2 +- neutron/tests/unit/objects/qos/test_policy.py | 12 +++++----- .../ml2/drivers/agent/test__common_agent.py | 6 ++--- .../metering/agents/test_metering_agent.py | 2 +- neutron/wsgi.py | 6 ++--- tox.ini | 5 ++--- 44 files changed, 113 insertions(+), 114 deletions(-) diff --git a/neutron/agent/l2/extensions/qos.py b/neutron/agent/l2/extensions/qos.py index 302a6a27ef3..5387372eb8d 100644 --- a/neutron/agent/l2/extensions/qos.py +++ b/neutron/agent/l2/extensions/qos.py @@ -285,9 +285,9 @@ class QosAgentExtension(l2_agent_extension.L2AgentExtension): if old_qos_policy: if self._policy_rules_modified(old_qos_policy, qos_policy): for port in self.policy_map.get_ports(qos_policy): - #NOTE(QoS): for now, just reflush the rules on the port. - # Later, we may want to apply the difference - # between the old and new rule lists. + # NOTE(QoS): for now, just reflush the rules on the port. + # Later, we may want to apply the difference + # between the old and new rule lists. self.qos_driver.delete(port, old_qos_policy) self.qos_driver.update(port, qos_policy) self.policy_map.update_policy(qos_policy) diff --git a/neutron/agent/l3/dvr_local_router.py b/neutron/agent/l3/dvr_local_router.py index 0b79cd8a82f..7eace9e2ab7 100644 --- a/neutron/agent/l3/dvr_local_router.py +++ b/neutron/agent/l3/dvr_local_router.py @@ -124,7 +124,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase): fixed_ip = fip['fixed_ip_address'] self._add_floating_ip_rule(floating_ip, fixed_ip) fip_2_rtr_name = self.fip_ns.get_int_device_name(self.router_id) - #Add routing rule in fip namespace + # Add routing rule in fip namespace fip_ns_name = self.fip_ns.get_name() if self.rtr_fip_subnet is None: self.rtr_fip_subnet = self.fip_ns.local_subnets.allocate( @@ -156,7 +156,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase): table=dvr_fip_ns.FIP_RT_TBL, priority=rule_pr) self.fip_ns.deallocate_rule_priority(floating_ip) - #TODO(rajeev): Handle else case - exception/log? + # TODO(rajeev): Handle else case - exception/log? def floating_ip_removed_dist(self, fip_cidr): """Remove floating IP from FIP namespace.""" diff --git a/neutron/agent/l3/router_info.py b/neutron/agent/l3/router_info.py index 555bd09f46b..6c93ff19ac3 100644 --- a/neutron/agent/l3/router_info.py +++ b/neutron/agent/l3/router_info.py @@ -150,7 +150,7 @@ class RouterInfo(object): for del_route in removes: if route['destination'] == del_route['destination']: removes.remove(del_route) - #replace success even if there is no existing route + # replace success even if there is no existing route self.update_routing_table('replace', route) for route in removes: LOG.debug("Removed route entry is '%s'", route) diff --git a/neutron/agent/linux/iptables_firewall.py b/neutron/agent/linux/iptables_firewall.py index 29d22f48c30..33e47a23bd0 100644 --- a/neutron/agent/linux/iptables_firewall.py +++ b/neutron/agent/linux/iptables_firewall.py @@ -491,7 +491,7 @@ class IptablesFirewallDriver(firewall.FirewallDriver): '-j RETURN', comment=ic.DHCP_CLIENT)] def _drop_dhcp_rule(self, ipv4_rules, ipv6_rules): - #Note(nati) Drop dhcp packet from VM + # Note(nati) Drop dhcp packet from VM ipv4_rules += [comment_rule('-p udp -m udp --sport 67 ' '--dport 68 ' '-j DROP', comment=ic.DHCP_SPOOF)] @@ -593,8 +593,8 @@ class IptablesFirewallDriver(firewall.FirewallDriver): ethertype = sg_rule.get('ethertype') ipset_name = self.ipset.get_name(remote_gid, ethertype) if not self.ipset.set_name_exists(ipset_name): - #NOTE(mangelajo): ipsets for empty groups are not created - # thus we can't reference them. + # NOTE(mangelajo): ipsets for empty groups are not created + # thus we can't reference them. return None ipset_direction = IPSET_DIRECTION[sg_rule.get('direction')] args = self._generate_protocol_and_port_args(sg_rule) @@ -703,7 +703,7 @@ class IptablesFirewallDriver(firewall.FirewallDriver): return args def _ip_prefix_arg(self, direction, ip_prefix): - #NOTE (nati) : source_group_id is converted to list of source_ + # NOTE (nati) : source_group_id is converted to list of source_ # ip_prefix in server side if ip_prefix: if '/' not in ip_prefix: diff --git a/neutron/agent/linux/keepalived.py b/neutron/agent/linux/keepalived.py index 65e935c8ff9..c3d0cb49d0e 100644 --- a/neutron/agent/linux/keepalived.py +++ b/neutron/agent/linux/keepalived.py @@ -378,7 +378,7 @@ class KeepalivedManager(object): if throttle_restart_value is not None: self._throttle_spawn(throttle_restart_value) - #pylint: disable=method-hidden + # pylint: disable=method-hidden def _throttle_spawn(self, threshold): self.spawn = utils.throttler(threshold)(self.spawn) diff --git a/neutron/agent/linux/tc_lib.py b/neutron/agent/linux/tc_lib.py index 6cd8a0803d3..78dd831b714 100644 --- a/neutron/agent/linux/tc_lib.py +++ b/neutron/agent/linux/tc_lib.py @@ -112,10 +112,10 @@ class TcCommand(ip_lib.IPDevice): for line in cmd_result.split("\n"): m = filters_pattern.match(line.strip()) if m: - #NOTE(slaweq): because tc is giving bw limit in SI units + # NOTE(slaweq): because tc is giving bw limit in SI units # we need to calculate it as 1000bit = 1kbit: bw_limit = convert_to_kilobits(m.group(1), constants.SI_BASE) - #NOTE(slaweq): because tc is giving burst limit in IEC units + # NOTE(slaweq): because tc is giving burst limit in IEC units # we need to calculate it as 1024bit = 1kbit: burst_limit = convert_to_kilobits( m.group(2), constants.IEC_BASE) @@ -133,10 +133,10 @@ class TcCommand(ip_lib.IPDevice): qdisc_name = m.group(1) if qdisc_name != "tbf": return None, None - #NOTE(slaweq): because tc is giving bw limit in SI units + # NOTE(slaweq): because tc is giving bw limit in SI units # we need to calculate it as 1000bit = 1kbit: bw_limit = convert_to_kilobits(m.group(2), constants.SI_BASE) - #NOTE(slaweq): because tc is giving burst limit in IEC units + # NOTE(slaweq): because tc is giving burst limit in IEC units # we need to calculate it as 1024bit = 1kbit: burst_limit = convert_to_kilobits(m.group(3), constants.IEC_BASE) return bw_limit, burst_limit @@ -148,7 +148,7 @@ class TcCommand(ip_lib.IPDevice): means that it is fine to limit egress traffic from instance point of view. """ - #because replace of tc filters is not working properly and it's adding + # because replace of tc filters is not working properly and it's adding # new filters each time instead of replacing existing one first old # ingress qdisc should be deleted and then added new one so update will # be called to do that: @@ -172,7 +172,7 @@ class TcCommand(ip_lib.IPDevice): return self._replace_tbf_qdisc(bw_limit, burst_limit, latency_value) def delete_filters_bw_limit(self): - #NOTE(slaweq): For limit traffic egress from instance we need to use + # NOTE(slaweq): For limit traffic egress from instance we need to use # qdisc "ingress" because it is ingress traffic from interface POV: self._delete_qdisc("ingress") @@ -220,7 +220,7 @@ class TcCommand(ip_lib.IPDevice): self.get_ingress_qdisc_burst_value(bw_limit, burst_limit), BURST_UNIT ) - #NOTE(slaweq): it is made in exactly same way how openvswitch is doing + # NOTE(slaweq): it is made in exactly same way how openvswitch is doing # it when configuing ingress traffic limit on port. It can be found in # lib/netdev-linux.c#L4698 in openvswitch sources: cmd = [ diff --git a/neutron/agent/linux/utils.py b/neutron/agent/linux/utils.py index 356a3047845..4eae41b62ad 100644 --- a/neutron/agent/linux/utils.py +++ b/neutron/agent/linux/utils.py @@ -227,8 +227,8 @@ def kill_process(pid, signal, run_as_root=False): def _get_conf_base(cfg_root, uuid, ensure_conf_dir): - #TODO(mangelajo): separate responsibilities here, ensure_conf_dir - # should be a separate function + # TODO(mangelajo): separate responsibilities here, ensure_conf_dir + # should be a separate function conf_dir = os.path.abspath(os.path.normpath(cfg_root)) conf_base = os.path.join(conf_dir, uuid) if ensure_conf_dir: diff --git a/neutron/api/rpc/callbacks/consumer/registry.py b/neutron/api/rpc/callbacks/consumer/registry.py index 358c348ca73..7495e137346 100644 --- a/neutron/api/rpc/callbacks/consumer/registry.py +++ b/neutron/api/rpc/callbacks/consumer/registry.py @@ -13,8 +13,8 @@ from neutron.api.rpc.callbacks import resource_manager -#TODO(ajo): consider adding locking to _get_manager, it's -# safe for eventlet, but not for normal threading. +# TODO(ajo): consider adding locking to _get_manager, it's +# safe for eventlet, but not for normal threading. def _get_manager(): return resource_manager.ConsumerResourceCallbacksManager() diff --git a/neutron/api/rpc/callbacks/version_manager.py b/neutron/api/rpc/callbacks/version_manager.py index feaa522f0e7..07d8fad885c 100644 --- a/neutron/api/rpc/callbacks/version_manager.py +++ b/neutron/api/rpc/callbacks/version_manager.py @@ -236,7 +236,7 @@ class CachedResourceConsumerTracker(object): _cached_version_tracker = None -#NOTE(ajo): add locking if we ever stop using greenthreads +# NOTE(ajo): add locking if we ever stop using greenthreads def _get_cached_tracker(): global _cached_version_tracker if not _cached_version_tracker: diff --git a/neutron/common/utils.py b/neutron/common/utils.py index 1ad6d5c7cf5..24e3235dde8 100644 --- a/neutron/common/utils.py +++ b/neutron/common/utils.py @@ -640,7 +640,7 @@ def wait_until_true(predicate, timeout=60, sleep=1, exception=None): eventlet.sleep(sleep) except eventlet.Timeout: if exception is not None: - #pylint: disable=raising-bad-type + # pylint: disable=raising-bad-type raise exception raise WaitTimeout("Timed out after %d seconds" % timeout) @@ -803,5 +803,5 @@ def bytes_to_bits(value): def bits_to_kilobits(value, base): - #NOTE(slaweq): round up that even 1 bit will give 1 kbit as a result + # NOTE(slaweq): round up that even 1 bit will give 1 kbit as a result return int((value + (base - 1)) / base) diff --git a/neutron/conf/extensions/allowedaddresspairs.py b/neutron/conf/extensions/allowedaddresspairs.py index 1e64bc251dc..0bbe1d22574 100644 --- a/neutron/conf/extensions/allowedaddresspairs.py +++ b/neutron/conf/extensions/allowedaddresspairs.py @@ -18,7 +18,7 @@ from neutron._i18n import _ allowed_address_pair_opts = [ - #TODO(limao): use quota framework when it support quota for attributes + # TODO(limao): use quota framework when it support quota for attributes cfg.IntOpt('max_allowed_address_pair', default=10, help=_("Maximum number of allowed address pairs")), ] diff --git a/neutron/db/agents_db.py b/neutron/db/agents_db.py index 84d61c78098..bdd81ca126f 100644 --- a/neutron/db/agents_db.py +++ b/neutron/db/agents_db.py @@ -406,8 +406,8 @@ class AgentExtRpcCallback(object): def __init__(self, plugin=None): super(AgentExtRpcCallback, self).__init__() self.plugin = plugin - #TODO(ajo): fix the resources circular dependency issue by dynamically - # registering object types in the RPC callbacks api + # TODO(ajo): fix the resources circular dependency issue by dynamically + # registering object types in the RPC callbacks api resources_rpc = importutils.import_module( 'neutron.api.rpc.handlers.resources_rpc') # Initialize RPC api directed to other neutron-servers diff --git a/neutron/db/extraroute_db.py b/neutron/db/extraroute_db.py index 77c6148dcd1..336f2045d90 100644 --- a/neutron/db/extraroute_db.py +++ b/neutron/db/extraroute_db.py @@ -49,7 +49,7 @@ class ExtraRoute_dbonly_mixin(l3_db.L3_NAT_dbonly_mixin): r = router['router'] if 'routes' in r: with context.session.begin(subtransactions=True): - #check if route exists and have permission to access + # check if route exists and have permission to access router_db = self._get_router(context, id) self._update_extra_routes(context, router_db, r['routes']) # NOTE(yamamoto): expire to ensure the following update_router @@ -59,14 +59,14 @@ class ExtraRoute_dbonly_mixin(l3_db.L3_NAT_dbonly_mixin): context, id, router) def _validate_routes_nexthop(self, cidrs, ips, routes, nexthop): - #Note(nati): Nexthop should be connected, + # Note(nati): Nexthop should be connected, # so we need to check # nexthop belongs to one of cidrs of the router ports if not netaddr.all_matching_cidrs(nexthop, cidrs): raise xroute_exc.InvalidRoutes( routes=routes, reason=_('the nexthop is not connected with router')) - #Note(nati) nexthop should not be same as fixed_ips + # Note(nati) nexthop should not be same as fixed_ips if nexthop in ips: raise xroute_exc.InvalidRoutes( routes=routes, diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py index be9972d055f..e7efb1e5b25 100644 --- a/neutron/db/l3_db.py +++ b/neutron/db/l3_db.py @@ -558,7 +558,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase, def delete_router(self, context, id): registry.notify(resources.ROUTER, events.BEFORE_DELETE, self, context=context, router_id=id) - #TODO(nati) Refactor here when we have router insertion model + # TODO(nati) Refactor here when we have router insertion model router = self._ensure_router_not_in_use(context, id) original = self._make_router_dict(router) self._delete_current_gw_port(context, id, router, None) diff --git a/neutron/db/migration/alembic_migrations/versions/mitaka/contract/8a6d8bdae39_migrate_neutron_resources_table.py b/neutron/db/migration/alembic_migrations/versions/mitaka/contract/8a6d8bdae39_migrate_neutron_resources_table.py index b42d669cc8f..33a70df7044 100644 --- a/neutron/db/migration/alembic_migrations/versions/mitaka/contract/8a6d8bdae39_migrate_neutron_resources_table.py +++ b/neutron/db/migration/alembic_migrations/versions/mitaka/contract/8a6d8bdae39_migrate_neutron_resources_table.py @@ -74,7 +74,7 @@ def generate_records_for_existing(): for row in session.query(model): # NOTE(kevinbenton): without this disabled, pylint complains # about a missing 'dml' argument. - #pylint: disable=no-value-for-parameter + # pylint: disable=no-value-for-parameter res = session.execute( standardattrs.insert().values(resource_type=table)) session.execute( diff --git a/neutron/db/migration/alembic_migrations/versions/newton/contract/97c25b0d2353_add_name_desc.py b/neutron/db/migration/alembic_migrations/versions/newton/contract/97c25b0d2353_add_name_desc.py index bbaf5741d43..ef4df73f39f 100644 --- a/neutron/db/migration/alembic_migrations/versions/newton/contract/97c25b0d2353_add_name_desc.py +++ b/neutron/db/migration/alembic_migrations/versions/newton/contract/97c25b0d2353_add_name_desc.py @@ -51,7 +51,7 @@ def update_existing_records(): for row in session.query(TBL_MODEL): # NOTE from kevinbenton: without this disabled, pylint complains # about a missing 'dml' argument. - #pylint: disable=no-value-for-parameter + # pylint: disable=no-value-for-parameter res = session.execute( standardattrs.insert().values(resource_type=TBL) ) diff --git a/neutron/db/migration/alembic_migrations/versions/newton/contract/b12a3ef66e62_add_standardattr_to_qos_policies.py b/neutron/db/migration/alembic_migrations/versions/newton/contract/b12a3ef66e62_add_standardattr_to_qos_policies.py index 3c01c1fde86..66004dc18ac 100644 --- a/neutron/db/migration/alembic_migrations/versions/newton/contract/b12a3ef66e62_add_standardattr_to_qos_policies.py +++ b/neutron/db/migration/alembic_migrations/versions/newton/contract/b12a3ef66e62_add_standardattr_to_qos_policies.py @@ -71,7 +71,7 @@ def generate_records_for_existing(): for row in session.query(TABLE_MODEL): # NOTE(kevinbenton): without this disabled, pylint complains # about a missing 'dml' argument. - #pylint: disable=no-value-for-parameter + # pylint: disable=no-value-for-parameter res = session.execute( standardattrs.insert().values(resource_type=TABLE, description=row[1]) diff --git a/neutron/db/migration/cli.py b/neutron/db/migration/cli.py index 6030be6b545..875007e0df8 100644 --- a/neutron/db/migration/cli.py +++ b/neutron/db/migration/cli.py @@ -649,7 +649,7 @@ def main(): CONF(project='neutron') return_val = False for config in get_alembic_configs(): - #TODO(gongysh) enable logging + # TODO(gongysh) enable logging return_val |= bool(CONF.command.func(config, CONF.command.name)) if CONF.command.name == 'has_offline_migrations' and not return_val: diff --git a/neutron/db/quota/driver.py b/neutron/db/quota/driver.py index 7312496edc4..dffbdbf3743 100644 --- a/neutron/db/quota/driver.py +++ b/neutron/db/quota/driver.py @@ -104,7 +104,7 @@ class DbQuotaDriver(object): 'used': used, 'reserved': res_reserve_info.get(key, 0), } - #update with specific tenant limits + # update with specific tenant limits quota_objs = quota_obj.Quota.get_objects(context, project_id=tenant_id) for item in quota_objs: tenant_quota_ext[item['resource']]['limit'] = item['limit'] diff --git a/neutron/db/standard_attr.py b/neutron/db/standard_attr.py index ad89a6474bf..1ce9be6e59f 100644 --- a/neutron/db/standard_attr.py +++ b/neutron/db/standard_attr.py @@ -121,7 +121,7 @@ class HasStandardAttributes(object): # NOTE(kevinbenton): we have to disable the following pylint check because # it thinks we are overriding this method in the __init__ method. - #pylint: disable=method-hidden + # pylint: disable=method-hidden @declarative.declared_attr def standard_attr(cls): return sa.orm.relationship(StandardAttribute, diff --git a/neutron/debug/shell.py b/neutron/debug/shell.py index adc43ceb577..97dedec2042 100644 --- a/neutron/debug/shell.py +++ b/neutron/debug/shell.py @@ -38,7 +38,7 @@ COMMAND_V2 = { 'neutron.debug.commands.ExecProbe'), 'ping-all': importutils.import_class( 'neutron.debug.commands.PingAll'), - #TODO(nati) ping, netcat , nmap, bench + # TODO(nati) ping, netcat , nmap, bench } COMMANDS = {'2.0': COMMAND_V2} diff --git a/neutron/objects/qos/rule.py b/neutron/objects/qos/rule.py index 76d90b1afec..f7b54fedd11 100644 --- a/neutron/objects/qos/rule.py +++ b/neutron/objects/qos/rule.py @@ -50,9 +50,9 @@ class QosRule(base.NeutronDbObject): # 1.2: Added QosMinimumBandwidthRule # 1.3: Added direction for BandwidthLimitRule # - #NOTE(mangelajo): versions need to be handled from the top QosRule object - # because it's the only reference QosPolicy can make - # to them via obj_relationships version map + # NOTE(mangelajo): versions need to be handled from the top QosRule object + # because it's the only reference QosPolicy can make + # to them via obj_relationships version map VERSION = '1.3' fields = { diff --git a/neutron/plugins/ml2/drivers/agent/_common_agent.py b/neutron/plugins/ml2/drivers/agent/_common_agent.py index b03ebbfb439..4e5b15ac950 100644 --- a/neutron/plugins/ml2/drivers/agent/_common_agent.py +++ b/neutron/plugins/ml2/drivers/agent/_common_agent.py @@ -88,7 +88,7 @@ class CommonAgentLoop(service.Service): configurations = {'extensions': self.ext_manager.names()} configurations.update(self.mgr.get_agent_configurations()) - #TODO(mangelajo): optimize resource_versions (see ovs agent) + # TODO(mangelajo): optimize resource_versions (see ovs agent) self.agent_state = { 'binary': self.agent_binary, 'host': cfg.CONF.host, diff --git a/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py index 97da8a3482e..02579bd0043 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py @@ -187,10 +187,10 @@ class EmbSwitch(object): @param rate_kbps: device rate in kbps """ vf_index = self._get_vf_index(pci_slot) - #NOTE(ralonsoh): ip link sets rate in Mbps therefore we need to convert - #the rate_kbps value from kbps to Mbps. - #Zero means to disable the rate so the lowest rate available is 1Mbps. - #Floating numbers are not allowed + # NOTE(ralonsoh): ip link sets rate in Mbps therefore we need to + # convert the rate_kbps value from kbps to Mbps. + # Zero means to disable the rate so the lowest rate available is 1Mbps. + # Floating numbers are not allowed if rate_kbps > 0 and rate_kbps < 1000: rate_mbps = 1 else: @@ -441,15 +441,15 @@ class ESwitchManager(object): @param pci_slot: VF PCI slot @param rate_type: rate to clear ('rate', 'min_tx_rate') """ - #NOTE(Moshe Levi): we don't use the self._get_emb_eswitch here, because - #when clearing the VF it may be not assigned. This happens when - #libvirt releases the VF back to the hypervisor on delete VM. Therefore - #we should just clear the VF rate according to pci_slot no matter - #if VF is assigned or not. + # NOTE(Moshe Levi): we don't use the self._get_emb_eswitch here, + # because when clearing the VF it may be not assigned. This happens + # when libvirt releases the VF back to the hypervisor on delete VM. + # Therefore we should just clear the VF rate according to pci_slot no + # matter if VF is assigned or not. embedded_switch = self.pci_slot_map.get(pci_slot) if embedded_switch: - #NOTE(Moshe Levi): check the pci_slot is not assigned to some - #other port before resetting the rate. + # NOTE(Moshe Levi): check the pci_slot is not assigned to some + # other port before resetting the rate. if embedded_switch.get_pci_device(pci_slot) is None: embedded_switch.set_device_rate(pci_slot, rate_type, 0) else: diff --git a/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py index 3d3dee8e7cd..4a993cec832 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py @@ -134,7 +134,7 @@ class SriovNicSwitchAgent(object): configurations = {'device_mappings': physical_devices_mappings, 'extensions': self.ext_manager.names()} - #TODO(mangelajo): optimize resource_versions (see ovs agent) + # TODO(mangelajo): optimize resource_versions (see ovs agent) self.agent_state = { 'binary': 'neutron-sriov-nic-agent', 'host': self.conf.host, diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py b/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py index af1a115f97a..6a982f33495 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py @@ -105,9 +105,9 @@ class QosOVSAgentDriver(qos.QosLinuxAgentDriver): port_name = vif_port.port_name port = self.br_int.get_port_ofport(port_name) mark = rule.dscp_mark - #mark needs to be bit shifted 2 left to not overwrite the - #lower 2 bits of type of service packet header. - #source: man ovs-ofctl (/mod_nw_tos) + # mark needs to be bit shifted 2 left to not overwrite the + # lower 2 bits of type of service packet header. + # source: man ovs-ofctl (/mod_nw_tos) mark = str(mark << 2) # reg2 is a metadata field that does not alter packets. diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py index db5208139da..3d4aff59b1a 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -255,9 +255,9 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin, self.prevent_arp_spoofing = ( not self.sg_agent.firewall.provides_arp_spoofing_protection) - #TODO(mangelajo): optimize resource_versions to only report - # versions about resources which are common, - # or which are used by specific extensions. + # TODO(mangelajo): optimize resource_versions to only report + # versions about resources which are common, + # or which are used by specific extensions. self.agent_state = { 'binary': 'neutron-openvswitch-agent', 'host': host, @@ -1268,7 +1268,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin, events['added'] = [e for e in events['added'] if e['name'] != p] - #TODO(rossella_s): scanning the ancillary bridge won't be needed + # TODO(rossella_s): scanning the ancillary bridge won't be needed # anymore when https://review.openstack.org/#/c/203381 since the bridge # id stored in external_ids will be used to identify the bridge the # port belongs to diff --git a/neutron/scheduler/dhcp_agent_scheduler.py b/neutron/scheduler/dhcp_agent_scheduler.py index 17f4f13b668..cab0cc41fdd 100644 --- a/neutron/scheduler/dhcp_agent_scheduler.py +++ b/neutron/scheduler/dhcp_agent_scheduler.py @@ -222,7 +222,7 @@ class DhcpFilter(base_resource_filter.BaseResourceFilter): network is already hosted by enough number of agents. """ agents_per_network = cfg.CONF.dhcp_agents_per_network - #TODO(gongysh) don't schedule the networks with only + # TODO(gongysh) don't schedule the networks with only # subnets whose enable_dhcp is false with context.session.begin(subtransactions=True): network_hosted_agents = plugin.get_dhcp_agents_hosting_networks( diff --git a/neutron/tests/fullstack/resources/environment.py b/neutron/tests/fullstack/resources/environment.py index 93d173cea80..174c0cc58c0 100644 --- a/neutron/tests/fullstack/resources/environment.py +++ b/neutron/tests/fullstack/resources/environment.py @@ -170,8 +170,8 @@ class Host(fixtures.Fixture): self.ovs_agent.agent_cfg_fixture.get_br_int_name())) def setup_host_with_linuxbridge_agent(self): - #First we need to provide connectivity for agent to prepare proper - #bridge mappings in agent's config: + # First we need to provide connectivity for agent to prepare proper + # bridge mappings in agent's config: self.host_namespace = self.useFixture( net_helpers.NamespaceFixture(prefix="host-") ).name @@ -365,13 +365,13 @@ class Environment(fixtures.Fixture): def _setUp(self): self.temp_dir = self.useFixture(fixtures.TempDir()).path - #we need this bridge before rabbit and neutron service will start + # we need this bridge before rabbit and neutron service will start self.central_data_bridge = self.useFixture( net_helpers.OVSBridgeFixture('cnt-data')).bridge self.central_external_bridge = self.useFixture( net_helpers.OVSBridgeFixture('cnt-ex')).bridge - #Get rabbitmq address (and cnt-data network) + # Get rabbitmq address (and cnt-data network) rabbitmq_ip_address = self._configure_port_for_rabbitmq() self.rabbitmq_environment = self.useFixture( process.RabbitmqEnvironmentFixture(host=rabbitmq_ip_address) @@ -406,7 +406,7 @@ class Environment(fixtures.Fixture): return rabbitmq_ip def _get_network_range(self): - #NOTE(slaweq): We need to choose IP address on which rabbitmq will be + # NOTE(slaweq): We need to choose IP address on which rabbitmq will be # available because LinuxBridge agents are spawned in their own # namespaces and need to know where the rabbitmq server is listening. # For ovs agent it is not necessary because agents are spawned in diff --git a/neutron/tests/functional/agent/test_l2_ovs_agent.py b/neutron/tests/functional/agent/test_l2_ovs_agent.py index c2d3f0c7891..4c1d923f9fa 100644 --- a/neutron/tests/functional/agent/test_l2_ovs_agent.py +++ b/neutron/tests/functional/agent/test_l2_ovs_agent.py @@ -63,7 +63,7 @@ class TestOVSAgent(base.OVSAgentTestFramework): ofports = [port.ofport for port in self.agent.int_br.get_vif_ports() if port.port_name in portnames] - #wait until ports are marked dead, with drop flow + # wait until ports are marked dead, with drop flow utils.wait_until_true( lambda: num_ports_with_drop_flows( ofports, @@ -71,12 +71,12 @@ class TestOVSAgent(base.OVSAgentTestFramework): constants.LOCAL_SWITCHING )) == len(ofports)) - #delete the ports on bridge + # delete the ports on bridge for port in self.ports: self.agent.int_br.delete_port(port['vif_name']) self.wait_until_ports_state(self.ports, up=False) - #verify no stale drop flows + # verify no stale drop flows self.assertEqual(0, num_ports_with_drop_flows( ofports, diff --git a/neutron/tests/functional/db/test_migrations.py b/neutron/tests/functional/db/test_migrations.py index 386397f90b7..caf0e649d4b 100644 --- a/neutron/tests/functional/db/test_migrations.py +++ b/neutron/tests/functional/db/test_migrations.py @@ -399,7 +399,7 @@ class TestSanityCheck(testlib_api.SqlTestCaseLight): self.addCleanup(self._drop_table, ha_router_agent_port_bindings) # NOTE(haleyb): without this disabled, pylint complains # about a missing 'dml' argument. - #pylint: disable=no-value-for-parameter + # pylint: disable=no-value-for-parameter conn.execute(ha_router_agent_port_bindings.insert(), [ {'port_id': '1234', 'router_id': '12345', 'l3_agent_id': '123'}, @@ -424,7 +424,7 @@ class TestSanityCheck(testlib_api.SqlTestCaseLight): self.addCleanup(self._drop_table, routerports) # NOTE(haleyb): without this disabled, pylint complains # about a missing 'dml' argument. - #pylint: disable=no-value-for-parameter + # pylint: disable=no-value-for-parameter conn.execute(routerports.insert(), [ {'router_id': '1234', 'port_id': '12345', 'port_type': '123'}, @@ -449,7 +449,7 @@ class TestSanityCheck(testlib_api.SqlTestCaseLight): self.addCleanup(self._drop_table, floatingips) # NOTE(haleyb): without this disabled, pylint complains # about a missing 'dml' argument. - #pylint: disable=no-value-for-parameter + # pylint: disable=no-value-for-parameter conn.execute(floatingips.insert(), [ {'floating_network_id': '12345', 'fixed_port_id': '1234567', @@ -476,7 +476,7 @@ class TestSanityCheck(testlib_api.SqlTestCaseLight): self.addCleanup(self._drop_table, floatingips) # NOTE(haleyb): without this disabled, pylint complains # about a missing 'dml' argument. - #pylint: disable=no-value-for-parameter + # pylint: disable=no-value-for-parameter conn.execute(floatingips.insert(), [ {'floating_network_id': '12345', 'fixed_port_id': '1234567', diff --git a/neutron/tests/unit/agent/linux/test_iptables_firewall.py b/neutron/tests/unit/agent/linux/test_iptables_firewall.py index 7d51dd90a31..aad0358481f 100644 --- a/neutron/tests/unit/agent/linux/test_iptables_firewall.py +++ b/neutron/tests/unit/agent/linux/test_iptables_firewall.py @@ -34,12 +34,12 @@ from neutron.tests.unit.api.v2 import test_base _uuid = test_base._uuid -#TODO(mangelajo): replace all 'IPv4', 'IPv6' to constants +# TODO(mangelajo): replace all 'IPv4', 'IPv6' to constants FAKE_PREFIX = {'IPv4': '10.0.0.0/24', 'IPv6': 'fe80::/48'} FAKE_IP = {'IPv4': '10.0.0.1', 'IPv6': 'fe80::1'} -#TODO(mangelajo): replace all '*_sgid' strings for the constants +# TODO(mangelajo): replace all '*_sgid' strings for the constants FAKE_SGID = 'fake_sgid' OTHER_SGID = 'other_sgid' _IPv6 = constants.IPv6 diff --git a/neutron/tests/unit/agent/test_securitygroups_rpc.py b/neutron/tests/unit/agent/test_securitygroups_rpc.py index 769f8f1549d..5a17b204c39 100644 --- a/neutron/tests/unit/agent/test_securitygroups_rpc.py +++ b/neutron/tests/unit/agent/test_securitygroups_rpc.py @@ -1363,7 +1363,7 @@ class SecurityGroupAgentRpcApiTestCase(base.BaseTestCase): None, security_groups=[]) self.assertFalse(self.mock_cast.called) -#Note(nati) bn -> binary_name +# Note(nati) bn -> binary_name # id -> device_id PHYSDEV_MOD = '-m physdev' @@ -3217,7 +3217,7 @@ class TestSecurityGroupAgentWithOVSIptables( self._verify_mock_calls() def _regex(self, value): - #Note(nati): tap is prefixed on the device + # Note(nati): tap is prefixed on the device # in the OVSHybridIptablesFirewallDriver value = value.replace('tap_port', 'taptap_port') diff --git a/neutron/tests/unit/db/test_db_base_plugin_v2.py b/neutron/tests/unit/db/test_db_base_plugin_v2.py index a39d912e176..56699945dee 100644 --- a/neutron/tests/unit/db/test_db_base_plugin_v2.py +++ b/neutron/tests/unit/db/test_db_base_plugin_v2.py @@ -1052,7 +1052,7 @@ class TestPortsV2(NeutronDbPluginV2TestCase): def test_create_ports_bulk_emulated(self): real_has_attr = hasattr - #ensures the API choose the emulation code path + # ensures the API choose the emulation code path def fakehasattr(item, attr): if attr.endswith('__native_bulk_support'): return False @@ -1092,7 +1092,7 @@ class TestPortsV2(NeutronDbPluginV2TestCase): def test_create_ports_bulk_emulated_plugin_failure(self): real_has_attr = hasattr - #ensures the API choose the emulation code path + # ensures the API choose the emulation code path def fakehasattr(item, attr): if attr.endswith('__native_bulk_support'): return False @@ -2827,7 +2827,7 @@ class TestNetworksV2(NeutronDbPluginV2TestCase): def test_create_networks_bulk_emulated(self): real_has_attr = hasattr - #ensures the API choose the emulation code path + # ensures the API choose the emulation code path def fakehasattr(item, attr): if attr.endswith('__native_bulk_support'): return False @@ -2858,7 +2858,7 @@ class TestNetworksV2(NeutronDbPluginV2TestCase): return real_has_attr(item, attr) orig = directory.get_plugin().create_network - #ensures the API choose the emulation code path + # ensures the API choose the emulation code path with mock.patch('six.moves.builtins.hasattr', new=fakehasattr): method_to_patch = _get_create_db_method('network') @@ -3307,7 +3307,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase): def test_create_subnets_bulk_emulated(self): real_has_attr = hasattr - #ensures the API choose the emulation code path + # ensures the API choose the emulation code path def fakehasattr(item, attr): if attr.endswith('__native_bulk_support'): return False @@ -3324,7 +3324,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase): def test_create_subnets_bulk_emulated_plugin_failure(self): real_has_attr = hasattr - #ensures the API choose the emulation code path + # ensures the API choose the emulation code path def fakehasattr(item, attr): if attr.endswith('__native_bulk_support'): return False @@ -4767,12 +4767,12 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase): data['subnet']['gateway_ip'] = '192.168.0.9' req = self.new_update_request('subnets', data, subnet['subnet']['id']) - #check res code and contents + # check res code and contents res = req.get_response(self.api) self.assertEqual(200, res.status_code) self._verify_updated_subnet_allocation_pools(res, with_gateway_ip) - #GET subnet to verify DB updated correctly + # GET subnet to verify DB updated correctly req = self.new_show_request('subnets', subnet['subnet']['id'], self.fmt) res = req.get_response(self.api) @@ -4785,7 +4785,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase): def test_update_subnet_allocation_pools_and_gateway_ip(self): self._test_update_subnet_allocation_pools(with_gateway_ip=True) - #updating alloc pool to something outside subnet.cidr + # updating alloc pool to something outside subnet.cidr def test_update_subnet_allocation_pools_invalid_pool_for_cidr(self): """Test update alloc pool to something outside subnet.cidr. @@ -4805,7 +4805,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase): self.assertEqual(webob.exc.HTTPClientError.code, res.status_int) - #updating alloc pool on top of existing subnet.gateway_ip + # updating alloc pool on top of existing subnet.gateway_ip def test_update_subnet_allocation_pools_over_gateway_ip_returns_409(self): allocation_pools = [{'start': '10.0.0.2', 'end': '10.0.0.254'}] with self.network() as network: diff --git a/neutron/tests/unit/extensions/foxinsocks.py b/neutron/tests/unit/extensions/foxinsocks.py index b39c847362d..e6b1384c659 100644 --- a/neutron/tests/unit/extensions/foxinsocks.py +++ b/neutron/tests/unit/extensions/foxinsocks.py @@ -77,7 +77,7 @@ class Foxinsocks(api_extensions.ExtensionDescriptor): request_exts = [] def _goose_handler(req, res): - #NOTE: This only handles JSON responses. + # NOTE: This only handles JSON responses. # You can use content type header to test for XML. data = jsonutils.loads(res.body) data['FOXNSOX:googoose'] = req.GET.get('chewing') @@ -89,7 +89,7 @@ class Foxinsocks(api_extensions.ExtensionDescriptor): request_exts.append(req_ext1) def _bands_handler(req, res): - #NOTE: This only handles JSON responses. + # NOTE: This only handles JSON responses. # You can use content type header to test for XML. data = jsonutils.loads(res.body) data['FOXNSOX:big_bands'] = 'Pig Bands!' diff --git a/neutron/tests/unit/extensions/test_l3.py b/neutron/tests/unit/extensions/test_l3.py index 032f2aa6132..590fa8d81c6 100644 --- a/neutron/tests/unit/extensions/test_l3.py +++ b/neutron/tests/unit/extensions/test_l3.py @@ -1929,7 +1929,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin): None, None, exc.HTTPBadRequest.code) - #remove properly to clean-up + # remove properly to clean-up self._router_interface_action('remove', r['router']['id'], None, @@ -3532,7 +3532,7 @@ class L3AgentDbTestCaseBase(L3NatTestCaseMixin): self.assertIn(router1_id, device_list) self.assertIn(router2_id, device_list) - #Verify if no router pass in, return empty list + # Verify if no router pass in, return empty list ifaces = self.plugin._get_sync_interfaces(admin_ctx, None) self.assertEqual(0, len(ifaces)) diff --git a/neutron/tests/unit/extensions/test_securitygroup.py b/neutron/tests/unit/extensions/test_securitygroup.py index a8bd399dd87..bb7ba14fc00 100644 --- a/neutron/tests/unit/extensions/test_securitygroup.py +++ b/neutron/tests/unit/extensions/test_securitygroup.py @@ -1546,7 +1546,7 @@ class TestSecurityGroups(SecurityGroupDBTestCase): def test_create_security_group_rule_bulk_emulated(self): real_has_attr = hasattr - #ensures the API choose the emulation code path + # ensures the API choose the emulation code path def fakehasattr(item, attr): if attr.endswith('__native_bulk_support'): return False @@ -1617,7 +1617,7 @@ class TestSecurityGroups(SecurityGroupDBTestCase): def test_create_security_group_rule_duplicate_rule_in_post_emulated(self): real_has_attr = hasattr - #ensures the API choose the emulation code path + # ensures the API choose the emulation code path def fakehasattr(item, attr): if attr.endswith('__native_bulk_support'): return False @@ -1654,7 +1654,7 @@ class TestSecurityGroups(SecurityGroupDBTestCase): def test_create_security_group_rule_duplicate_rule_db_emulated(self): real_has_attr = hasattr - #ensures the API choose the emulation code path + # ensures the API choose the emulation code path def fakehasattr(item, attr): if attr.endswith('__native_bulk_support'): return False diff --git a/neutron/tests/unit/extensions/test_timestamp.py b/neutron/tests/unit/extensions/test_timestamp.py index aaec8963d0e..7e3b5202f1b 100644 --- a/neutron/tests/unit/extensions/test_timestamp.py +++ b/neutron/tests/unit/extensions/test_timestamp.py @@ -157,7 +157,7 @@ class TimeStampChangedsinceTestCase(test_db_base_plugin_v2. self.assertIn(new_second[resource_type]['id'], [n['id'] for n in resources[resource_type + 's']]) - #test first < second < changed_since + # test first < second < changed_since resources = self._return_by_timedelay(new_second, 3) self.assertEqual({resource_type + 's': []}, resources) diff --git a/neutron/tests/unit/objects/port/extensions/test_allowedaddresspairs.py b/neutron/tests/unit/objects/port/extensions/test_allowedaddresspairs.py index bf2bcae6cc9..a6e81c569fa 100644 --- a/neutron/tests/unit/objects/port/extensions/test_allowedaddresspairs.py +++ b/neutron/tests/unit/objects/port/extensions/test_allowedaddresspairs.py @@ -20,7 +20,7 @@ class AllowedAddrPairsIfaceObjTestCase(obj_test_base.BaseObjectIfaceTestCase): _test_class = allowedaddresspairs.AllowedAddressPair -#TODO(mhickey): Add common base db test class specifically for port extensions +# TODO(mhickey): Add common base db test class specifically for port extensions class AllowedAddrPairsDbObjTestCase(obj_test_base.BaseDbObjectTestCase, testlib_api.SqlTestCase): diff --git a/neutron/tests/unit/objects/qos/test_policy.py b/neutron/tests/unit/objects/qos/test_policy.py index 7cc6447d1cd..0dd5324582f 100644 --- a/neutron/tests/unit/objects/qos/test_policy.py +++ b/neutron/tests/unit/objects/qos/test_policy.py @@ -446,8 +446,8 @@ class QosPolicyDbObjectTestCase(test_base.BaseDbObjectTestCase, policy_obj.obj_to_primitive('1.2') def test_object_version_degradation_to_1_0(self): - #NOTE(mangelajo): we should not check .VERSION, since that's the - # local version on the class definition + # NOTE(mangelajo): we should not check .VERSION, since that's the + # local version on the class definition policy_obj, rule_objs = self._create_test_policy_with_rules( [qos_consts.RULE_TYPE_BANDWIDTH_LIMIT, qos_consts.RULE_TYPE_DSCP_MARKING, @@ -461,8 +461,8 @@ class QosPolicyDbObjectTestCase(test_base.BaseDbObjectTestCase, self.assertNotIn(rule_objs[2], policy_obj_v1_0.rules) def test_object_version_degradation_1_2_to_1_1(self): - #NOTE(mangelajo): we should not check .VERSION, since that's the - # local version on the class definition + # NOTE(mangelajo): we should not check .VERSION, since that's the + # local version on the class definition policy_obj, rule_objs = self._create_test_policy_with_rules( [qos_consts.RULE_TYPE_BANDWIDTH_LIMIT, qos_consts.RULE_TYPE_DSCP_MARKING, @@ -476,8 +476,8 @@ class QosPolicyDbObjectTestCase(test_base.BaseDbObjectTestCase, self.assertNotIn(rule_objs[2], policy_obj_v1_1.rules) def test_object_version_degradation_1_3_to_1_2(self): - #NOTE(mangelajo): we should not check .VERSION, since that's the - # local version on the class definition + # NOTE(mangelajo): we should not check .VERSION, since that's the + # local version on the class definition policy_obj, rule_objs = self._create_test_policy_with_rules( [qos_consts.RULE_TYPE_BANDWIDTH_LIMIT, qos_consts.RULE_TYPE_DSCP_MARKING, diff --git a/neutron/tests/unit/plugins/ml2/drivers/agent/test__common_agent.py b/neutron/tests/unit/plugins/ml2/drivers/agent/test__common_agent.py index a97372ed825..c7091bbf5cf 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/agent/test__common_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/agent/test__common_agent.py @@ -554,7 +554,7 @@ class TestCommonAgentLoop(base.BaseTestCase): self.agent.network_ports[NETWORK_ID].append( port_2_data ) - #check update port: + # check update port: self.agent._update_network_ports( NETWORK_2_ID, port_2_data['port_id'], port_2_data['device'] ) @@ -573,13 +573,13 @@ class TestCommonAgentLoop(base.BaseTestCase): self.agent.network_ports[NETWORK_ID].append( port_2_data ) - #check removing port from network when other ports are still there: + # check removing port from network when other ports are still there: cleaned_port_id = self.agent._clean_network_ports(DEVICE_1) self.assertIn(NETWORK_ID, self.agent.network_ports.keys()) self.assertNotIn(port_1_data, self.agent.network_ports[NETWORK_ID]) self.assertIn(port_2_data, self.agent.network_ports[NETWORK_ID]) self.assertEqual(PORT_1, cleaned_port_id) - #and now remove last port from network: + # and now remove last port from network: cleaned_port_id = self.agent._clean_network_ports( port_2_data['device'] ) diff --git a/neutron/tests/unit/services/metering/agents/test_metering_agent.py b/neutron/tests/unit/services/metering/agents/test_metering_agent.py index d2007046f75..f657f9ffd28 100644 --- a/neutron/tests/unit/services/metering/agents/test_metering_agent.py +++ b/neutron/tests/unit/services/metering/agents/test_metering_agent.py @@ -147,7 +147,7 @@ class TestMeteringOperations(base.BaseTestCase): if len(fake_notifier.NOTIFICATIONS) > 1: for n in fake_notifier.NOTIFICATIONS: if n['event_type'] == 'l3.meter': - #skip the first notification because the time is 0 + # skip the first notification because the time is 0 count += 1 if count > 1: break diff --git a/neutron/wsgi.py b/neutron/wsgi.py index 0f827de71fb..ef04f1965cf 100644 --- a/neutron/wsgi.py +++ b/neutron/wsgi.py @@ -242,13 +242,13 @@ class Request(wsgi.Request): if _format in ['json']: return 'application/{0}'.format(_format) - #Then look up content header + # Then look up content header type_from_header = self.get_content_type() if type_from_header: return type_from_header ctypes = ['application/json'] - #Finally search in Accept-* headers + # Finally search in Accept-* headers bm = self.accept.best_match(ctypes) return bm or 'application/json' @@ -629,7 +629,7 @@ class Resource(Application): controller_method = getattr(self.controller, action) try: - #NOTE(salvatore-orlando): the controller method must have + # NOTE(salvatore-orlando): the controller method must have # an argument whose name is 'request' return controller_method(request=request, **action_args) except TypeError: diff --git a/tox.ini b/tox.ini index fb7944409b7..51e5aedfe3e 100644 --- a/tox.ini +++ b/tox.ini @@ -138,15 +138,14 @@ commands = sphinx-build -W -b linkcheck doc/source doc/build/linkcheck # E126 continuation line over-indented for hanging indent # E128 continuation line under-indented for visual indent # E129 visually indented line with same indent as next logical line -# E265 block comment should start with '# ' # H404 multi line docstring should start with a summary # H405 multi line docstring summary not separated with an empty line # N530 direct neutron imports not allowed -# TODO(ihrachys) figure out what to do with N534 and N536 +# TODO(ihrachys) figure out what to do with N534 # N534 Untranslated exception message # TODO(amotoki) check the following new rules should be fixed or ignored # E731 do not assign a lambda expression, use a def -ignore = E125,E126,E128,E129,E265,E731,H404,H405,N530,N534 +ignore = E125,E126,E128,E129,E731,H404,H405,N530,N534 # H106: Don't put vim configuration in source files # H203: Use assertIs(Not)None to check for None # H204: Use assert(Not)Equal to check for equality