From 548ab45a50d9ea4effba2f75ff0af294da0ccb13 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Mon, 12 Jan 2015 17:27:14 +0100 Subject: [PATCH] hacking: enable H238 (old style class declaration, use new style) The rule was added in hacking 0.10 and is useful for migration to Python 3. Change-Id: I8b45413cf34e5a9db8074f9029410e3b22a92640 --- neutron/agent/linux/ovs_lib.py | 2 +- neutron/debug/debug_agent.py | 2 +- neutron/extensions/extraroute.py | 2 +- neutron/plugins/brocade/nos/fake_nosdriver.py | 2 +- neutron/plugins/brocade/nos/nosdriver.py | 2 +- .../service_helpers/routing_svc_helper.py | 2 +- neutron/plugins/cisco/common/config.py | 2 +- neutron/plugins/embrane/common/constants.py | 4 +- neutron/plugins/ibm/sdnve_api_fake.py | 2 +- neutron/plugins/ibm/sdnve_neutron_plugin.py | 2 +- .../agent/linuxbridge_neutron_agent.py | 4 +- neutron/plugins/midonet/midonet_lib.py | 2 +- .../ml2/drivers/brocade/nos/nosdriver.py | 2 +- .../ofagent/agent/ofa_neutron_agent.py | 2 +- .../agent/ovs_dvr_neutron_agent.py | 4 +- .../openvswitch/agent/ovs_neutron_agent.py | 2 +- .../plugins/plumgrid/drivers/fake_plumlib.py | 2 +- neutron/plugins/sriovnicagent/pci_lib.py | 2 +- neutron/plugins/vmware/common/config.py | 6 +- neutron/plugins/vmware/common/sync.py | 4 +- neutron/plugins/vmware/common/utils.py | 2 +- neutron/plugins/vmware/vshield/tasks/tasks.py | 4 +- neutron/tests/unit/bigswitch/fake_server.py | 2 +- neutron/tests/unit/midonet/mock_lib.py | 4 +- .../tests/unit/midonet/test_midonet_driver.py | 2 +- neutron/tests/unit/nec/test_pfc_driver.py | 2 +- .../tests/unit/openvswitch/test_ovs_tunnel.py | 4 +- neutron/tests/unit/test_api_v2.py | 2 +- neutron/tests/unit/test_dhcp_agent.py | 14 ++-- neutron/tests/unit/test_linux_dhcp.py | 78 +++++++++---------- neutron/tests/unit/test_linux_interface.py | 8 +- .../tests/unit/test_security_groups_rpc.py | 2 +- neutron/tests/unit/test_wsgi.py | 4 +- tox.ini | 3 +- 34 files changed, 91 insertions(+), 92 deletions(-) diff --git a/neutron/agent/linux/ovs_lib.py b/neutron/agent/linux/ovs_lib.py index 7b2d2a225..1fcea9dfa 100644 --- a/neutron/agent/linux/ovs_lib.py +++ b/neutron/agent/linux/ovs_lib.py @@ -75,7 +75,7 @@ def _ofport_retry(fn): return wrapped -class VifPort: +class VifPort(object): def __init__(self, port_name, ofport, vif_id, vif_mac, switch): self.port_name = port_name self.ofport = ofport diff --git a/neutron/debug/debug_agent.py b/neutron/debug/debug_agent.py index 28a7f13c5..4eef85abc 100644 --- a/neutron/debug/debug_agent.py +++ b/neutron/debug/debug_agent.py @@ -34,7 +34,7 @@ DEVICE_OWNER_NETWORK_PROBE = 'network:probe' DEVICE_OWNER_COMPUTE_PROBE = 'compute:probe' -class NeutronDebugAgent(): +class NeutronDebugAgent(object): OPTS = [ # Needed for drivers diff --git a/neutron/extensions/extraroute.py b/neutron/extensions/extraroute.py index 7c63baa22..43384393f 100644 --- a/neutron/extensions/extraroute.py +++ b/neutron/extensions/extraroute.py @@ -44,7 +44,7 @@ EXTENDED_ATTRIBUTES_2_0 = { } -class Extraroute(): +class Extraroute(object): @classmethod def get_name(cls): diff --git a/neutron/plugins/brocade/nos/fake_nosdriver.py b/neutron/plugins/brocade/nos/fake_nosdriver.py index 5f7393fd9..cbf2221c5 100644 --- a/neutron/plugins/brocade/nos/fake_nosdriver.py +++ b/neutron/plugins/brocade/nos/fake_nosdriver.py @@ -21,7 +21,7 @@ Neutron network life-cycle management. """ -class NOSdriver(): +class NOSdriver(object): """NOS NETCONF interface driver for Neutron network. Fake: Handles life-cycle management of Neutron network, diff --git a/neutron/plugins/brocade/nos/nosdriver.py b/neutron/plugins/brocade/nos/nosdriver.py index fccf59608..c5d86f491 100644 --- a/neutron/plugins/brocade/nos/nosdriver.py +++ b/neutron/plugins/brocade/nos/nosdriver.py @@ -40,7 +40,7 @@ def nos_unknown_host_cb(host, fingerprint): return True -class NOSdriver(): +class NOSdriver(object): """NOS NETCONF interface driver for Neutron network. Handles life-cycle management of Neutron network (leverages AMPP on NOS) diff --git a/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py b/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py index ffce42e15..da284804a 100644 --- a/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py +++ b/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py @@ -106,7 +106,7 @@ class CiscoRoutingPluginApi(object): router_ids=router_ids, hosting_device_ids=hd_ids) -class RoutingServiceHelper(): +class RoutingServiceHelper(object): def __init__(self, host, conf, cfg_agent): self.conf = conf diff --git a/neutron/plugins/cisco/common/config.py b/neutron/plugins/cisco/common/config.py index 359dd11d2..48388ba0a 100644 --- a/neutron/plugins/cisco/common/config.py +++ b/neutron/plugins/cisco/common/config.py @@ -106,7 +106,7 @@ device_dictionary = {} first_device_ip = None -class CiscoConfigOptions(): +class CiscoConfigOptions(object): """Cisco Configuration Options Class.""" def __init__(self): diff --git a/neutron/plugins/embrane/common/constants.py b/neutron/plugins/embrane/common/constants.py index 709d94676..8b1c42d1e 100644 --- a/neutron/plugins/embrane/common/constants.py +++ b/neutron/plugins/embrane/common/constants.py @@ -23,7 +23,7 @@ UTIF_LIMIT = 7 QUEUE_TIMEOUT = 300 -class Status: +class Status(object): # Transient CREATING = constants.PENDING_CREATE UPDATING = constants.PENDING_UPDATE @@ -35,7 +35,7 @@ class Status: DELETED = "DELETED" # not visible -class Events: +class Events(object): CREATE_ROUTER = "create_router" UPDATE_ROUTER = "update_router" DELETE_ROUTER = "delete_router" diff --git a/neutron/plugins/ibm/sdnve_api_fake.py b/neutron/plugins/ibm/sdnve_api_fake.py index b68e67b3c..b1deeb1b6 100644 --- a/neutron/plugins/ibm/sdnve_api_fake.py +++ b/neutron/plugins/ibm/sdnve_api_fake.py @@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__) HTTP_OK = 200 -class FakeClient(): +class FakeClient(object): '''Fake Client for SDNVE controller.''' diff --git a/neutron/plugins/ibm/sdnve_neutron_plugin.py b/neutron/plugins/ibm/sdnve_neutron_plugin.py index 962c680a0..a24f027a6 100644 --- a/neutron/plugins/ibm/sdnve_neutron_plugin.py +++ b/neutron/plugins/ibm/sdnve_neutron_plugin.py @@ -43,7 +43,7 @@ from neutron.plugins.ibm import sdnve_api_fake as sdnve_fake LOG = logging.getLogger(__name__) -class SdnveRpcCallbacks(): +class SdnveRpcCallbacks(object): def __init__(self, notifier): self.notifier = notifier # used to notify the agent diff --git a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py index b302e199e..872db5109 100755 --- a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -60,14 +60,14 @@ BRIDGE_PORT_FS_FOR_DEVICE = BRIDGE_FS + DEVICE_NAME_PLACEHOLDER + "/brport" VXLAN_INTERFACE_PREFIX = "vxlan-" -class NetworkSegment: +class NetworkSegment(object): def __init__(self, network_type, physical_network, segmentation_id): self.network_type = network_type self.physical_network = physical_network self.segmentation_id = segmentation_id -class LinuxBridgeManager: +class LinuxBridgeManager(object): def __init__(self, interface_mappings, root_helper): self.interface_mappings = interface_mappings self.root_helper = root_helper diff --git a/neutron/plugins/midonet/midonet_lib.py b/neutron/plugins/midonet/midonet_lib.py index b4d206a33..be806c1c2 100644 --- a/neutron/plugins/midonet/midonet_lib.py +++ b/neutron/plugins/midonet/midonet_lib.py @@ -44,7 +44,7 @@ class MidonetApiException(n_exc.NeutronException): message = _("MidoNet API error: %(msg)s") -class MidoClient: +class MidoClient(object): def __init__(self, mido_api): self.mido_api = mido_api diff --git a/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py b/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py index 617c96bd1..c028eeb3b 100644 --- a/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py +++ b/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py @@ -41,7 +41,7 @@ def nos_unknown_host_cb(host, fingerprint): return True -class NOSdriver(): +class NOSdriver(object): """NOS NETCONF interface driver for Neutron network. Handles life-cycle management of Neutron network (leverages AMPP on NOS) diff --git a/neutron/plugins/ofagent/agent/ofa_neutron_agent.py b/neutron/plugins/ofagent/agent/ofa_neutron_agent.py index d75dc3f18..2ea34e31f 100644 --- a/neutron/plugins/ofagent/agent/ofa_neutron_agent.py +++ b/neutron/plugins/ofagent/agent/ofa_neutron_agent.py @@ -60,7 +60,7 @@ cfg.CONF.import_group('AGENT', 'neutron.plugins.ofagent.common.config') # A class to represent a VIF (i.e., a port that has 'iface-id' and 'vif-mac' # attributes set). -class LocalVLANMapping: +class LocalVLANMapping(object): def __init__(self, vlan, network_type, physical_network, segmentation_id, vif_ports=None): assert(isinstance(vlan, (int, long))) diff --git a/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py index aebdb6245..6e2bceb5e 100644 --- a/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py @@ -30,7 +30,7 @@ LOG = logging.getLogger(__name__) # A class to represent a DVR-hosted subnet including vif_ports resident on # that subnet -class LocalDVRSubnetMapping: +class LocalDVRSubnetMapping(object): def __init__(self, subnet, csnat_ofport=constants.OFPORT_INVALID): # set of commpute ports on on this dvr subnet self.compute_ports = {} @@ -72,7 +72,7 @@ class LocalDVRSubnetMapping: return self.csnat_ofport -class OVSPort: +class OVSPort(object): def __init__(self, id, ofport, mac, device_owner): self.id = id self.mac = mac diff --git a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py index 4fd77e37e..181fbf1fe 100644 --- a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py @@ -63,7 +63,7 @@ class DeviceListRetrievalError(exceptions.NeutronException): # A class to represent a VIF (i.e., a port that has 'iface-id' and 'vif-mac' # attributes set). -class LocalVLANMapping: +class LocalVLANMapping(object): def __init__(self, vlan, network_type, physical_network, segmentation_id, vif_ports=None): if vif_ports is None: diff --git a/neutron/plugins/plumgrid/drivers/fake_plumlib.py b/neutron/plugins/plumgrid/drivers/fake_plumlib.py index 90e5c4ccb..307cbaabb 100644 --- a/neutron/plugins/plumgrid/drivers/fake_plumlib.py +++ b/neutron/plugins/plumgrid/drivers/fake_plumlib.py @@ -19,7 +19,7 @@ from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) -class Plumlib(): +class Plumlib(object): """ Class PLUMgrid Fake Library. This library is a by-pass implementation for the PLUMgrid Library. This class is being used by the unit test diff --git a/neutron/plugins/sriovnicagent/pci_lib.py b/neutron/plugins/sriovnicagent/pci_lib.py index 313501275..f1f6a35ab 100644 --- a/neutron/plugins/sriovnicagent/pci_lib.py +++ b/neutron/plugins/sriovnicagent/pci_lib.py @@ -36,7 +36,7 @@ class PciDeviceIPWrapper(ip_lib.IPWrapper): VF_LINE_FORMAT = VF_PATTERN + MAC_PATTERN + ANY_PATTERN + STATE_PATTERN VF_DETAILS_REG_EX = re.compile(VF_LINE_FORMAT) - class LinkState: + class LinkState(object): ENABLE = "enable" DISABLE = "disable" diff --git a/neutron/plugins/vmware/common/config.py b/neutron/plugins/vmware/common/config.py index 01735ae10..df144f3d7 100644 --- a/neutron/plugins/vmware/common/config.py +++ b/neutron/plugins/vmware/common/config.py @@ -17,18 +17,18 @@ from oslo.config import cfg from neutron.plugins.vmware.common import exceptions as nsx_exc -class AgentModes: +class AgentModes(object): AGENT = 'agent' AGENTLESS = 'agentless' COMBINED = 'combined' -class MetadataModes: +class MetadataModes(object): DIRECT = 'access_network' INDIRECT = 'dhcp_host_route' -class ReplicationModes: +class ReplicationModes(object): SERVICE = 'service' SOURCE = 'source' diff --git a/neutron/plugins/vmware/common/sync.py b/neutron/plugins/vmware/common/sync.py index d5aaaf96b..29326db19 100644 --- a/neutron/plugins/vmware/common/sync.py +++ b/neutron/plugins/vmware/common/sync.py @@ -165,7 +165,7 @@ class NsxCache(object): self._get_resource_ids(self._lswitchports, changed_only=True)) -class SyncParameters(): +class SyncParameters(object): """Defines attributes used by the synchronization procedure. chunk_size: Actual chunk size @@ -203,7 +203,7 @@ def _start_loopingcall(min_chunk_size, state_sync_interval, func): return state_synchronizer -class NsxSynchronizer(): +class NsxSynchronizer(object): LS_URI = nsxlib._build_uri_path( switchlib.LSWITCH_RESOURCE, fields='uuid,tags,fabric_status', diff --git a/neutron/plugins/vmware/common/utils.py b/neutron/plugins/vmware/common/utils.py index 49f5cf01d..24fc7179e 100644 --- a/neutron/plugins/vmware/common/utils.py +++ b/neutron/plugins/vmware/common/utils.py @@ -26,7 +26,7 @@ NEUTRON_VERSION = version.version_info.release_string() # Allowed network types for the NSX Plugin -class NetworkTypes: +class NetworkTypes(object): """Allowed provider network types for the NSX Plugin.""" L3_EXT = 'l3_ext' STT = 'stt' diff --git a/neutron/plugins/vmware/vshield/tasks/tasks.py b/neutron/plugins/vmware/vshield/tasks/tasks.py index 3f9ac2368..5012abd91 100644 --- a/neutron/plugins/vmware/vshield/tasks/tasks.py +++ b/neutron/plugins/vmware/vshield/tasks/tasks.py @@ -51,7 +51,7 @@ class TaskStateSkipped(TaskException): message = _("State %(state)d skipped. Current state %(current)d") -class Task(): +class Task(object): def __init__(self, name, resource_id, execute_callback, status_callback=nop, result_callback=nop, userdata=None): self.name = name @@ -147,7 +147,7 @@ class Task(): self.name, self.resource_id, self.id) -class TaskManager(): +class TaskManager(object): _instance = None _default_interval = DEFAULT_INTERVAL diff --git a/neutron/tests/unit/bigswitch/fake_server.py b/neutron/tests/unit/bigswitch/fake_server.py index cf1846b69..5a5994b14 100644 --- a/neutron/tests/unit/bigswitch/fake_server.py +++ b/neutron/tests/unit/bigswitch/fake_server.py @@ -20,7 +20,7 @@ from neutron.plugins.bigswitch import servermanager LOG = logging.getLogger(__name__) -class HTTPResponseMock(): +class HTTPResponseMock(object): status = 200 reason = 'OK' diff --git a/neutron/tests/unit/midonet/mock_lib.py b/neutron/tests/unit/midonet/mock_lib.py index c4022955f..8013ae5db 100644 --- a/neutron/tests/unit/midonet/mock_lib.py +++ b/neutron/tests/unit/midonet/mock_lib.py @@ -119,7 +119,7 @@ def get_subnet_mock(bridge_id=None, gateway_ip='10.0.0.1', return subnet -class MidonetLibMockConfig(): +class MidonetLibMockConfig(object): def __init__(self, inst): self.inst = inst @@ -169,7 +169,7 @@ class MidonetLibMockConfig(): self.inst.get_router.side_effect = self._get_router -class MidoClientMockConfig(): +class MidoClientMockConfig(object): def __init__(self, inst): self.inst = inst diff --git a/neutron/tests/unit/midonet/test_midonet_driver.py b/neutron/tests/unit/midonet/test_midonet_driver.py index 57544d908..983540722 100644 --- a/neutron/tests/unit/midonet/test_midonet_driver.py +++ b/neutron/tests/unit/midonet/test_midonet_driver.py @@ -23,7 +23,7 @@ import neutron.plugins.midonet.agent.midonet_driver as driver from neutron.tests import base -class FakeNetwork: +class FakeNetwork(object): id = 'aaaabbbb-cccc-dddd-eeee-ffff00001111' namespace = 'qdhcp-ns' diff --git a/neutron/tests/unit/nec/test_pfc_driver.py b/neutron/tests/unit/nec/test_pfc_driver.py index ad2ea7ae7..e14a6d2c9 100644 --- a/neutron/tests/unit/nec/test_pfc_driver.py +++ b/neutron/tests/unit/nec/test_pfc_driver.py @@ -364,7 +364,7 @@ class PFCV5DriverTest(PFCDriverTestBase): self.assertEqual(data['routes'], expected) -class PFCFilterDriverTestMixin: +class PFCFilterDriverTestMixin(object): def _test_create_filter(self, filter_dict=None, filter_post=None, apply_ports=None): t, n, p = self.get_ofc_item_random_params() diff --git a/neutron/tests/unit/openvswitch/test_ovs_tunnel.py b/neutron/tests/unit/openvswitch/test_ovs_tunnel.py index ee020d8cb..fdc055ec2 100644 --- a/neutron/tests/unit/openvswitch/test_ovs_tunnel.py +++ b/neutron/tests/unit/openvswitch/test_ovs_tunnel.py @@ -55,12 +55,12 @@ BCAST_MAC = "01:00:00:00:00:00/01:00:00:00:00:00" UCAST_MAC = "00:00:00:00:00:00/01:00:00:00:00:00" -class DummyPort: +class DummyPort(object): def __init__(self, interface_id): self.interface_id = interface_id -class DummyVlanBinding: +class DummyVlanBinding(object): def __init__(self, network_id, vlan_id): self.network_id = network_id self.vlan_id = vlan_id diff --git a/neutron/tests/unit/test_api_v2.py b/neutron/tests/unit/test_api_v2.py index ecc4c5020..df7328eed 100644 --- a/neutron/tests/unit/test_api_v2.py +++ b/neutron/tests/unit/test_api_v2.py @@ -1437,7 +1437,7 @@ class ExtensionTestCase(base.BaseTestCase, testlib_plugin.PluginSetupHelper): self.assertNotIn('v2attrs:something_else', net) -class TestSubresourcePlugin(): +class TestSubresourcePlugin(object): def get_network_dummies(self, context, network_id, filters=None, fields=None): return [] diff --git a/neutron/tests/unit/test_dhcp_agent.py b/neutron/tests/unit/test_dhcp_agent.py index 10ecbe69a..28b382b9a 100644 --- a/neutron/tests/unit/test_dhcp_agent.py +++ b/neutron/tests/unit/test_dhcp_agent.py @@ -339,7 +339,7 @@ class TestDhcpAgent(base.BaseTestCase): self._test_sync_state_helper(['b'], ['a']) def test_sync_state_waitall(self): - class mockNetwork(): + class mockNetwork(object): id = '0' admin_state_up = True subnets = [] @@ -1121,11 +1121,11 @@ class TestNetworkCache(base.BaseTestCase): self.assertEqual(nc.get_port_by_id(fake_port1.id), fake_port1) -class FakePort1: +class FakePort1(object): id = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee' -class FakeV4Subnet: +class FakeV4Subnet(object): id = 'dddddddd-dddd-dddd-dddd-dddddddddddd' ip_version = 4 cidr = '192.168.0.0/24' @@ -1133,7 +1133,7 @@ class FakeV4Subnet: enable_dhcp = True -class FakeV4SubnetNoGateway: +class FakeV4SubnetNoGateway(object): id = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee' ip_version = 4 cidr = '192.168.1.0/24' @@ -1141,20 +1141,20 @@ class FakeV4SubnetNoGateway: enable_dhcp = True -class FakeV4Network: +class FakeV4Network(object): id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' subnets = [FakeV4Subnet()] ports = [FakePort1()] namespace = 'qdhcp-aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' -class FakeV4NetworkNoSubnet: +class FakeV4NetworkNoSubnet(object): id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' subnets = [] ports = [] -class FakeV4NetworkNoGateway: +class FakeV4NetworkNoGateway(object): id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' subnets = [FakeV4SubnetNoGateway()] ports = [FakePort1()] diff --git a/neutron/tests/unit/test_linux_dhcp.py b/neutron/tests/unit/test_linux_dhcp.py index 216d17826..677535091 100644 --- a/neutron/tests/unit/test_linux_dhcp.py +++ b/neutron/tests/unit/test_linux_dhcp.py @@ -31,7 +31,7 @@ from neutron.tests import base LOG = logging.getLogger(__name__) -class FakeIPAllocation: +class FakeIPAllocation(object): def __init__(self, address, subnet_id=None): self.ip_address = address self.subnet_id = subnet_id @@ -45,7 +45,7 @@ class DhcpOpt(object): return str(self.__dict__) -class FakePort1: +class FakePort1(object): id = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee' admin_state_up = True device_owner = 'foo1' @@ -57,7 +57,7 @@ class FakePort1: self.extra_dhcp_opts = [] -class FakePort2: +class FakePort2(object): id = 'ffffffff-ffff-ffff-ffff-ffffffffffff' admin_state_up = False device_owner = 'foo2' @@ -69,7 +69,7 @@ class FakePort2: self.extra_dhcp_opts = [] -class FakePort3: +class FakePort3(object): id = '44444444-4444-4444-4444-444444444444' admin_state_up = True device_owner = 'foo3' @@ -83,7 +83,7 @@ class FakePort3: self.extra_dhcp_opts = [] -class FakePort4: +class FakePort4(object): id = 'gggggggg-gggg-gggg-gggg-gggggggggggg' admin_state_up = False @@ -98,7 +98,7 @@ class FakePort4: self.extra_dhcp_opts = [] -class FakeV6Port: +class FakeV6Port(object): id = 'hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh' admin_state_up = True device_owner = 'foo3' @@ -110,7 +110,7 @@ class FakeV6Port: self.extra_dhcp_opts = [] -class FakeDualPort: +class FakeDualPort(object): id = 'hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh' admin_state_up = True device_owner = 'foo3' @@ -124,7 +124,7 @@ class FakeDualPort: self.extra_dhcp_opts = [] -class FakeRouterPort: +class FakeRouterPort(object): id = 'rrrrrrrr-rrrr-rrrr-rrrr-rrrrrrrrrrrr' admin_state_up = True device_owner = constants.DEVICE_OWNER_ROUTER_INTF @@ -138,7 +138,7 @@ class FakeRouterPort: ip_address, 'dddddddd-dddd-dddd-dddd-dddddddddddd')] -class FakePortMultipleAgents1: +class FakePortMultipleAgents1(object): id = 'rrrrrrrr-rrrr-rrrr-rrrr-rrrrrrrrrrrr' admin_state_up = True device_owner = constants.DEVICE_OWNER_DHCP @@ -150,7 +150,7 @@ class FakePortMultipleAgents1: self.extra_dhcp_opts = [] -class FakePortMultipleAgents2: +class FakePortMultipleAgents2(object): id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' admin_state_up = True device_owner = constants.DEVICE_OWNER_DHCP @@ -162,22 +162,22 @@ class FakePortMultipleAgents2: self.extra_dhcp_opts = [] -class FakeV4HostRoute: +class FakeV4HostRoute(object): destination = '20.0.0.1/24' nexthop = '20.0.0.1' -class FakeV4HostRouteGateway: +class FakeV4HostRouteGateway(object): destination = '0.0.0.0/0' nexthop = '10.0.0.1' -class FakeV6HostRoute: +class FakeV6HostRoute(object): destination = '2001:0200:feed:7ac0::/64' nexthop = '2001:0200:feed:7ac0::1' -class FakeV4Subnet: +class FakeV4Subnet(object): id = 'dddddddd-dddd-dddd-dddd-dddddddddddd' ip_version = 4 cidr = '192.168.0.0/24' @@ -187,7 +187,7 @@ class FakeV4Subnet: dns_nameservers = ['8.8.8.8'] -class FakeV4MetadataSubnet: +class FakeV4MetadataSubnet(object): id = 'dddddddd-dddd-dddd-dddd-dddddddddddd' ip_version = 4 cidr = '169.254.169.254/30' @@ -197,7 +197,7 @@ class FakeV4MetadataSubnet: dns_nameservers = [] -class FakeV4SubnetGatewayRoute: +class FakeV4SubnetGatewayRoute(object): id = 'dddddddd-dddd-dddd-dddd-dddddddddddd' ip_version = 4 cidr = '192.168.0.0/24' @@ -207,7 +207,7 @@ class FakeV4SubnetGatewayRoute: dns_nameservers = ['8.8.8.8'] -class FakeV4SubnetMultipleAgentsWithoutDnsProvided: +class FakeV4SubnetMultipleAgentsWithoutDnsProvided(object): id = 'dddddddd-dddd-dddd-dddd-dddddddddddd' ip_version = 4 cidr = '192.168.0.0/24' @@ -217,7 +217,7 @@ class FakeV4SubnetMultipleAgentsWithoutDnsProvided: host_routes = [] -class FakeV4MultipleAgentsWithoutDnsProvided: +class FakeV4MultipleAgentsWithoutDnsProvided(object): id = 'ffffffff-ffff-ffff-ffff-ffffffffffff' subnets = [FakeV4SubnetMultipleAgentsWithoutDnsProvided()] ports = [FakePort1(), FakePort2(), FakePort3(), FakeRouterPort(), @@ -225,7 +225,7 @@ class FakeV4MultipleAgentsWithoutDnsProvided: namespace = 'qdhcp-ns' -class FakeV4SubnetMultipleAgentsWithDnsProvided: +class FakeV4SubnetMultipleAgentsWithDnsProvided(object): id = 'dddddddd-dddd-dddd-dddd-dddddddddddd' ip_version = 4 cidr = '192.168.0.0/24' @@ -235,7 +235,7 @@ class FakeV4SubnetMultipleAgentsWithDnsProvided: host_routes = [] -class FakeV4MultipleAgentsWithDnsProvided: +class FakeV4MultipleAgentsWithDnsProvided(object): id = 'ffffffff-ffff-ffff-ffff-ffffffffffff' subnets = [FakeV4SubnetMultipleAgentsWithDnsProvided()] ports = [FakePort1(), FakePort2(), FakePort3(), FakeRouterPort(), @@ -243,7 +243,7 @@ class FakeV4MultipleAgentsWithDnsProvided: namespace = 'qdhcp-ns' -class FakeV6Subnet: +class FakeV6Subnet(object): id = 'ffffffff-ffff-ffff-ffff-ffffffffffff' ip_version = 6 cidr = 'fdca:3ba5:a17a:4ba3::/64' @@ -255,7 +255,7 @@ class FakeV6Subnet: ipv6_address_mode = None -class FakeV4SubnetNoDHCP: +class FakeV4SubnetNoDHCP(object): id = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee' ip_version = 4 cidr = '192.168.1.0/24' @@ -265,7 +265,7 @@ class FakeV4SubnetNoDHCP: dns_nameservers = [] -class FakeV6SubnetDHCPStateful: +class FakeV6SubnetDHCPStateful(object): id = 'ffffffff-ffff-ffff-ffff-ffffffffffff' ip_version = 6 cidr = 'fdca:3ba5:a17a:4ba3::/64' @@ -277,7 +277,7 @@ class FakeV6SubnetDHCPStateful: ipv6_address_mode = constants.DHCPV6_STATEFUL -class FakeV6SubnetSlaac: +class FakeV6SubnetSlaac(object): id = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee' ip_version = 6 cidr = 'ffda:3ba5:a17a:4ba3::/64' @@ -288,7 +288,7 @@ class FakeV6SubnetSlaac: ipv6_ra_mode = None -class FakeV4SubnetNoGateway: +class FakeV4SubnetNoGateway(object): id = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee' ip_version = 4 cidr = '192.168.1.0/24' @@ -298,7 +298,7 @@ class FakeV4SubnetNoGateway: dns_nameservers = [] -class FakeV4SubnetNoRouter: +class FakeV4SubnetNoRouter(object): id = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee' ip_version = 4 cidr = '192.168.1.0/24' @@ -308,67 +308,67 @@ class FakeV4SubnetNoRouter: dns_nameservers = [] -class FakeV4Network: +class FakeV4Network(object): id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' subnets = [FakeV4Subnet()] ports = [FakePort1()] namespace = 'qdhcp-ns' -class FakeV6Network: +class FakeV6Network(object): id = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb' subnets = [FakeV6Subnet()] ports = [FakePort2()] namespace = 'qdhcp-ns' -class FakeDualNetwork: +class FakeDualNetwork(object): id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' subnets = [FakeV4Subnet(), FakeV6SubnetDHCPStateful()] ports = [FakePort1(), FakeV6Port(), FakeDualPort(), FakeRouterPort()] namespace = 'qdhcp-ns' -class FakeDualNetworkGatewayRoute: +class FakeDualNetworkGatewayRoute(object): id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' subnets = [FakeV4SubnetGatewayRoute(), FakeV6SubnetDHCPStateful()] ports = [FakePort1(), FakePort2(), FakePort3(), FakeRouterPort()] namespace = 'qdhcp-ns' -class FakeDualNetworkSingleDHCP: +class FakeDualNetworkSingleDHCP(object): id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' subnets = [FakeV4Subnet(), FakeV4SubnetNoDHCP()] ports = [FakePort1(), FakePort2(), FakePort3(), FakeRouterPort()] namespace = 'qdhcp-ns' -class FakeV4NoGatewayNetwork: +class FakeV4NoGatewayNetwork(object): id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' subnets = [FakeV4SubnetNoGateway()] ports = [FakePort1()] -class FakeV4NetworkNoRouter: +class FakeV4NetworkNoRouter(object): id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' subnets = [FakeV4SubnetNoRouter()] ports = [FakePort1()] -class FakeV4MetadataNetwork: +class FakeV4MetadataNetwork(object): id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' subnets = [FakeV4MetadataSubnet()] ports = [FakeRouterPort(ip_address='169.254.169.253')] -class FakeV4NetworkDistRouter: +class FakeV4NetworkDistRouter(object): id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' subnets = [FakeV4Subnet()] ports = [FakePort1(), FakeRouterPort(dev_owner=constants.DEVICE_OWNER_DVR_INTERFACE)] -class FakeDualV4Pxe3Ports: +class FakeDualV4Pxe3Ports(object): id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' subnets = [FakeV4Subnet(), FakeV4SubnetNoDHCP()] ports = [FakePort1(), FakePort2(), FakePort3(), FakeRouterPort()] @@ -403,7 +403,7 @@ class FakeDualV4Pxe3Ports: DhcpOpt(opt_name='bootfile-name', opt_value='pxelinux3.0')] -class FakeV4NetworkPxe2Ports: +class FakeV4NetworkPxe2Ports(object): id = 'dddddddd-dddd-dddd-dddd-dddddddddddd' subnets = [FakeV4Subnet()] ports = [FakePort1(), FakePort2(), FakeRouterPort()] @@ -430,7 +430,7 @@ class FakeV4NetworkPxe2Ports: DhcpOpt(opt_name='bootfile-name', opt_value='pxelinux.0')] -class FakeV4NetworkPxe3Ports: +class FakeV4NetworkPxe3Ports(object): id = 'dddddddd-dddd-dddd-dddd-dddddddddddd' subnets = [FakeV4Subnet()] ports = [FakePort1(), FakePort2(), FakePort3(), FakeRouterPort()] @@ -465,7 +465,7 @@ class FakeV4NetworkPxe3Ports: DhcpOpt(opt_name='bootfile-name', opt_value='pxelinux3.0')] -class FakeDualStackNetworkSingleDHCP: +class FakeDualStackNetworkSingleDHCP(object): id = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee' subnets = [FakeV4Subnet(), FakeV6SubnetSlaac()] diff --git a/neutron/tests/unit/test_linux_interface.py b/neutron/tests/unit/test_linux_interface.py index 0136bd240..df7b1970f 100644 --- a/neutron/tests/unit/test_linux_interface.py +++ b/neutron/tests/unit/test_linux_interface.py @@ -34,21 +34,21 @@ class BaseChild(interface.LinuxInterfaceDriver): pass -class FakeNetwork: +class FakeNetwork(object): id = '12345678-1234-5678-90ab-ba0987654321' -class FakeSubnet: +class FakeSubnet(object): cidr = '192.168.1.1/24' -class FakeAllocation: +class FakeAllocation(object): subnet = FakeSubnet() ip_address = '192.168.1.2' ip_version = 4 -class FakePort: +class FakePort(object): id = 'abcdef01-1234-5678-90ab-ba0987654321' fixed_ips = [FakeAllocation] device_id = 'cccccccc-cccc-cccc-cccc-cccccccccccc' diff --git a/neutron/tests/unit/test_security_groups_rpc.py b/neutron/tests/unit/test_security_groups_rpc.py index 865564c05..926b21a5d 100644 --- a/neutron/tests/unit/test_security_groups_rpc.py +++ b/neutron/tests/unit/test_security_groups_rpc.py @@ -2839,7 +2839,7 @@ class TestSecurityGroupAgentEnhancedIpsetWithIptables( self._verify_mock_calls() -class SGNotificationTestMixin(): +class SGNotificationTestMixin(object): def test_security_group_rule_updated(self): name = 'webservers' description = 'my webservers' diff --git a/neutron/tests/unit/test_wsgi.py b/neutron/tests/unit/test_wsgi.py index 0dbc36146..ffb3fa106 100644 --- a/neutron/tests/unit/test_wsgi.py +++ b/neutron/tests/unit/test_wsgi.py @@ -613,7 +613,7 @@ class ResourceTest(base.BaseTestCase): def my_fault_body_function(): return 'off' - class FakeRequest(): + class FakeRequest(object): def __init__(self): self.url = 'http://where.no' self.environ = 'environ' @@ -653,7 +653,7 @@ class ResourceTest(base.BaseTestCase): def my_fault_body_function(): return 'off' - class FakeRequest(): + class FakeRequest(object): def __init__(self): self.url = 'http://where.no' self.environ = 'environ' diff --git a/tox.ini b/tox.ini index fa7c6ad23..81dc56c1a 100644 --- a/tox.ini +++ b/tox.ini @@ -75,11 +75,10 @@ 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 ‘# ‘ -# H238 old style class declaration, use new style # H305 imports not grouped correctly # H404 multi line docstring should start with a summary # H405 multi line docstring summary not separated with an empty line -ignore = E125,E126,E128,E129,E265,H238,H305,H404,H405 +ignore = E125,E126,E128,E129,E265,H305,H404,H405 show-source = true builtins = _ # TODO(dougw) neutron/tests/unit/vmware exclusion is a temporary services split hack -- 2.45.2