From 27c3b54bf9b21e3ada93bfa3f4b5834a158f08d9 Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Wed, 11 Jun 2014 20:53:18 -0400 Subject: [PATCH] enable E713 in pep8 tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This change update the code style to enable the E713 check (test for membership should be ‘not in’) Partial-Bug: 1329017 Change-Id: I96f8b734db5964ef46d0911cb5f6e0b8c33c3119 --- neutron/plugins/bigswitch/plugin.py | 2 +- neutron/plugins/metaplugin/meta_neutron_plugin.py | 2 +- neutron/tests/unit/test_db_plugin.py | 2 +- neutron/tests/unit/vmware/apiclient/fake.py | 6 +++--- tox.ini | 3 +-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/neutron/plugins/bigswitch/plugin.py b/neutron/plugins/bigswitch/plugin.py index e2e051d75..400e8b31a 100644 --- a/neutron/plugins/bigswitch/plugin.py +++ b/neutron/plugins/bigswitch/plugin.py @@ -345,7 +345,7 @@ class NeutronRestProxyV2Base(db_base_plugin_v2.NeutronDbPluginV2, def _extend_port_dict_binding(self, context, port): cfg_vif_type = cfg.CONF.NOVA.vif_type.lower() - if not cfg_vif_type in (portbindings.VIF_TYPE_OVS, + if cfg_vif_type not in (portbindings.VIF_TYPE_OVS, portbindings.VIF_TYPE_IVS): LOG.warning(_("Unrecognized vif_type in configuration " "[%s]. Defaulting to ovs."), diff --git a/neutron/plugins/metaplugin/meta_neutron_plugin.py b/neutron/plugins/metaplugin/meta_neutron_plugin.py index f0b4ae45f..d8fb71a33 100644 --- a/neutron/plugins/metaplugin/meta_neutron_plugin.py +++ b/neutron/plugins/metaplugin/meta_neutron_plugin.py @@ -252,7 +252,7 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2, nets = [] for flavor, plugin in self.plugins.items(): if (filters and ext_flavor.FLAVOR_NETWORK in filters and - not flavor in filters[ext_flavor.FLAVOR_NETWORK]): + flavor not in filters[ext_flavor.FLAVOR_NETWORK]): continue if filters: #NOTE: copy each time since a target plugin may modify diff --git a/neutron/tests/unit/test_db_plugin.py b/neutron/tests/unit/test_db_plugin.py index 74292fac0..b4ff7f583 100644 --- a/neutron/tests/unit/test_db_plugin.py +++ b/neutron/tests/unit/test_db_plugin.py @@ -353,7 +353,7 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase, if ('device_owner' in kwargs and kwargs['device_owner'] == constants.DEVICE_OWNER_DHCP and 'host' in kwargs and - not 'device_id' in kwargs): + 'device_id' not in kwargs): device_id = utils.get_dhcp_agent_device_id(net_id, kwargs['host']) data['port']['device_id'] = device_id port_req = self.new_create_request('ports', data, fmt) diff --git a/neutron/tests/unit/vmware/apiclient/fake.py b/neutron/tests/unit/vmware/apiclient/fake.py index 1b5cc0ee3..99485805c 100644 --- a/neutron/tests/unit/vmware/apiclient/fake.py +++ b/neutron/tests/unit/vmware/apiclient/fake.py @@ -303,7 +303,7 @@ class FakeClient: def _build_relation(self, src, dst, resource_type, relation): if relation not in self.MANAGED_RELATIONS[resource_type]: return # Relation is not desired in output - if not '_relations' in src or not src['_relations'].get(relation): + if '_relations' not in src or not src['_relations'].get(relation): return # Item does not have relation relation_data = src['_relations'].get(relation) dst_relations = dst.get('_relations', {}) @@ -402,7 +402,7 @@ class FakeClient: def _lswitch_match(res_uuid): # verify that the switch exist - if parent_uuid and not parent_uuid in self._fake_lswitch_dict: + if parent_uuid and parent_uuid not in self._fake_lswitch_dict: raise Exception(_("lswitch:%s not found") % parent_uuid) if (not parent_uuid or res_dict[res_uuid].get('ls_uuid') == parent_uuid): @@ -411,7 +411,7 @@ class FakeClient: def _lrouter_match(res_uuid): # verify that the router exist - if parent_uuid and not parent_uuid in self._fake_lrouter_dict: + if parent_uuid and parent_uuid not in self._fake_lrouter_dict: raise Exception(_("lrouter:%s not found") % parent_uuid) if (not parent_uuid or res_dict[res_uuid].get('lr_uuid') == parent_uuid): diff --git a/tox.ini b/tox.ini index d5a1d1386..63abb8461 100644 --- a/tox.ini +++ b/tox.ini @@ -65,7 +65,6 @@ commands = python setup.py build_sphinx # 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 ‘# ‘ -# E713 test for membership should be ‘not in’ # F402 import module shadowed by loop variable # F811 redefinition of unused variable # F812 list comprehension redefines name from line @@ -77,7 +76,7 @@ commands = python setup.py build_sphinx # H405 multi line docstring summary not separated with an empty line # H904 Wrap long lines in parentheses instead of a backslash # TODO(marun) H404 multi line docstring should start with a summary -ignore = E125,E126,E128,E129,E265,E713,F402,F811,F812,H237,H305,H307,H401,H402,H404,H405,H904 +ignore = E125,E126,E128,E129,E265,F402,F811,F812,H237,H305,H307,H401,H402,H404,H405,H904 show-source = true builtins = _ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios -- 2.45.2