]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Enable H238 hacking rule
authorAnton Arefiev <aarefiev@mirantis.com>
Thu, 2 Apr 2015 16:12:52 +0000 (19:12 +0300)
committerAnton Arefiev <aarefiev@mirantis.com>
Thu, 2 Apr 2015 16:37:29 +0000 (19:37 +0300)
Hacking 0.10 introduces new hacking rule H238 - old style classes
are deprecated (they are converted to new style classes - inherit
from `object`). In order to avoid any unwanted side effects all
classes should be declared using new style.

See reference on the differences:
https://www.python.org/download/releases/2.2.3/descrintro/

Change-Id: Iec5620e8f9da2d051a3754391eab4e75faf644e0

22 files changed:
cinder/backup/drivers/swift.py
cinder/tests/api/openstack/test_wsgi.py
cinder/tests/monkey_patch_example/example_a.py
cinder/tests/monkey_patch_example/example_b.py
cinder/tests/test_backup_tsm.py
cinder/tests/test_emc_vmax.py
cinder/tests/test_emc_vnxdirect.py
cinder/tests/test_emc_xtremio.py
cinder/tests/test_hds.py
cinder/tests/test_hp3par.py
cinder/tests/test_hplefthand.py
cinder/tests/test_ibm_flashsystem.py
cinder/tests/test_openvstorage.py
cinder/tests/test_sheepdog.py
cinder/tests/test_storwize_svc.py
cinder/tests/test_utils.py
cinder/tests/test_volume.py
cinder/volume/drivers/hds/hus_backend.py
cinder/volume/drivers/nimble.py
cinder/volume/drivers/srb.py
cinder/volume/drivers/vmware/vmdk.py
tox.ini

index 1c302afc00f8455b99cd49949b9ddea989f339e9..7d0ba656cc58c379105beec4e2841a21c0e5defb 100644 (file)
@@ -167,7 +167,7 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver):
                                          preauthtoken=self.context.auth_token,
                                          starting_backoff=self.swift_backoff)
 
-    class SwiftObjectWriter:
+    class SwiftObjectWriter(object):
         def __init__(self, container, object_name, conn):
             self.container = container
             self.object_name = object_name
@@ -203,7 +203,7 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver):
                 raise exception.InvalidBackup(reason=err)
             return md5
 
-    class SwiftObjectReader:
+    class SwiftObjectReader(object):
         def __init__(self, container, object_name, conn):
             self.container = container
             self.object_name = object_name
index 67e57e71707062ca06f2b5a3fedaf7d4d507a55b..16ccbd718bc357c2ebdd649e8e0f9617d5fa6e8b 100644 (file)
@@ -400,7 +400,7 @@ class ResourceTest(test.TestCase):
                           '{"barAction": true}')
 
     def test_get_method_action_method(self):
-        class Controller():
+        class Controller(object):
             def action(self, req, pants=None):
                 return pants
 
index 3fdb4dcc0562ca4c51ef7e0d5284b01ab4b8da61..3844766ea7e53ee077f0bbc2033e44709d230324 100644 (file)
@@ -19,7 +19,7 @@ def example_function_a():
     return 'Example function'
 
 
-class ExampleClassA():
+class ExampleClassA(object):
     def example_method(self):
         return 'Example method'
 
index 2515fd2be4b90264c927db1cd75ed3f33064063e..52803377fc10665f642360e9bdb69a4dbf1b3aa3 100644 (file)
@@ -20,7 +20,7 @@ def example_function_b():
     return 'Example function'
 
 
-class ExampleClassB():
+class ExampleClassB(object):
     def example_method(self):
         return 'Example method'
 
index 035fa1f00439cddd813316360fac27c03d93a5f6..054c977a1f91c70369adf7e6e3c631198b5f0d37 100644 (file)
@@ -37,7 +37,7 @@ SIM = None
 VOLUME_PATH = '/dev/null'
 
 
-class TSMBackupSimulator:
+class TSMBackupSimulator(object):
     """Simulates TSM dsmc command.
 
     The simulator simulates the execution of the 'dsmc' command.
index d390ed4fff21784e1beaaba8a925480c578b0615..11b86a6389a1a19c3718019a61586c0c910587e0 100644 (file)
@@ -96,7 +96,7 @@ class SE_ReplicationSettingData(dict):
         self.DesiredCopyMethodology = 0
 
 
-class Fake_CIMProperty():
+class Fake_CIMProperty(object):
 
     def fake_getCIMProperty(self):
         cimproperty = Fake_CIMProperty()
@@ -144,7 +144,7 @@ class Fake_CIMProperty():
         return cimproperty
 
 
-class Fake_CIM_TierPolicyServiceCapabilities():
+class Fake_CIM_TierPolicyServiceCapabilities(object):
 
     def fake_getpolicyinstance(self):
         classinstance = Fake_CIM_TierPolicyServiceCapabilities()
@@ -169,7 +169,7 @@ class FakeCIMInstanceName(dict):
         return instancename
 
 
-class FakeDB():
+class FakeDB(object):
 
     def volume_update(self, context, volume_id, model_update):
         pass
@@ -200,7 +200,7 @@ class FakeDB():
         return snapshots
 
 
-class EMCVMAXCommonData():
+class EMCVMAXCommonData(object):
     wwpn1 = "123456789012345"
     wwpn2 = "123456789054321"
     connector = {'ip': '10.0.0.2',
@@ -433,12 +433,12 @@ class EMCVMAXCommonData():
                    'isV3': True}
 
 
-class FakeLookupService():
+class FakeLookupService(object):
     def get_device_mapping_from_network(self, initiator_wwns, target_wwns):
         return EMCVMAXCommonData.device_map
 
 
-class FakeEcomConnection():
+class FakeEcomConnection(object):
 
     def __init__(self, *args, **kwargs):
         self.data = EMCVMAXCommonData()
index e1bd14a1393016f9df59844f03c50548719b7e15..24b9349d6f658428599d5b2e07782f15cd9c433a 100644 (file)
@@ -33,7 +33,7 @@ FAKE_ERROR_RETURN = ("FAKE ERROR", 255)
 VERSION = emc_vnx_cli.EMCVnxCliBase.VERSION
 
 
-class EMCVNXCLIDriverTestData():
+class EMCVNXCLIDriverTestData(object):
 
     test_volume = {
         'name': 'vol1',
@@ -3666,7 +3666,7 @@ class EMCVNXCLIDriverFCTestCase(DriverTestCaseBase):
         fake_cli.assert_has_calls(expect_cmd)
 
 
-class EMCVNXCLIToggleSPTestData():
+class EMCVNXCLIToggleSPTestData(object):
     def FAKE_COMMAND_PREFIX(self, sp_address):
         return ('/opt/Navisphere/bin/naviseccli', '-address', sp_address,
                 '-user', 'sysadmin', '-password', 'sysadmin',
index a7e90db842f3201adc5d5f54ba5aae5c4ff390ea..9b28a6b677fa4a390bca644593a4222985cbcc8f 100644 (file)
@@ -166,7 +166,7 @@ class D(dict):
         return dict.update(self, *args, **kwargs)
 
 
-class CommonData():
+class CommonData(object):
     connector = {'ip': '10.0.0.2',
                  'initiator': 'iqn.1993-08.org.debian:01:222',
                  'wwpns': ["123456789012345", "123456789054321"],
index 65a2bf7889d104255f61f48211a678b3b0058b73..361cc0f7b6c43008f780eab8077b945e07c0d60f 100644 (file)
@@ -65,7 +65,7 @@ CONF = """<?xml version="1.0" encoding="UTF-8" ?>
 """
 
 
-class SimulatedHusBackend:
+class SimulatedHusBackend(object):
     """Simulation Back end. Talks to HUS."""
 
     alloc_lun = []              # allocated LUs
index d2405facf2d19ee198b9e207ee105a51dad6b6fc..a11d968146014bb19e577819d61979f5c4e41d9e 100644 (file)
@@ -3030,7 +3030,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
     def test_initialize_connection_with_lookup_single_nsp(self, mock_lookup):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
-        class fake_lookup_object:
+        class fake_lookup_object(object):
             def get_device_mapping_from_network(self, connector, target_wwns):
                 fake_map = {
                     'FAB_1': {
@@ -3185,7 +3185,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
     def test_terminate_connection_with_lookup(self, mock_lookup):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
-        class fake_lookup_object:
+        class fake_lookup_object(object):
             def get_device_mapping_from_network(self, connector, target_wwns):
                 fake_map = {
                     'FAB_1': {
index 3a7b8a99640072050f6bd2a0318cd379e3c4ef35..394581ad3679558746d87e463eb204e62d7d28d6 100644 (file)
@@ -37,7 +37,7 @@ FILTER_FUNCTION = \
     "capabilities.total_volumes < 400 && capabilities.capacity_utilization"
 
 
-class HPLeftHandBaseDriver():
+class HPLeftHandBaseDriver(object):
 
     cluster_id = 1
 
index eaae98df13d7a7c83305192879d157616ae063cf..929e101c3db6f08428b952dcabb4cb5fc389e16a 100644 (file)
@@ -41,7 +41,7 @@ from cinder.volume import volume_types
 LOG = logging.getLogger(__name__)
 
 
-class FlashSystemManagementSimulator:
+class FlashSystemManagementSimulator(object):
     def __init__(self):
         # Default protocol is FC
         self._protocol = 'FC'
index 2893d38ca3c9dff94fe807461746e3f73716297c..fce3116d4cbe8b098e7db954bfa088011feb4b84 100644 (file)
@@ -54,7 +54,7 @@ MOCK_image_id = '9999'
 CALLED = {}
 
 
-class MockVDiskController():
+class MockVDiskController(object):
 
     def create_volume(self, location, size):
         CALLED['create_volume'] = {'location': location, 'size': size}
@@ -84,20 +84,20 @@ class MockVDiskController():
                 'diskguid': diskguid}
 
 
-class MockStorageRouter():
+class MockStorageRouter(object):
     name = MOCK_hostname
 
 
-class MockStorageDriver():
+class MockStorageDriver(object):
     storagerouter = MockStorageRouter()
     mountpoint = MOCK_mountpoint
 
 
-class MockVPool():
+class MockVPool(object):
     storagedrivers = [MockStorageDriver()]
 
 
-class MockVDisk():
+class MockVDisk(object):
     vpool = MockVPool()
     cinder_id = None
     snapshots = []
@@ -121,7 +121,7 @@ class MockVDisk():
         pass
 
 
-class MockPMachine():
+class MockPMachine(object):
     guid = MOCK_pmachine_guid
     storagerouters = [MockStorageRouter()]
 
@@ -129,13 +129,13 @@ class MockPMachine():
         pass
 
 
-class MockVPoolList():
+class MockVPoolList(object):
 
     def get_vpool_by_name(self, name):
         return MockVPool()
 
 
-class MockVDiskList():
+class MockVDiskList(object):
 
     def __init__(self, vdisks = None):
         self.vdisks = vdisks
@@ -146,13 +146,13 @@ class MockVDiskList():
         return self.vdisks
 
 
-class MockPMachineList():
+class MockPMachineList(object):
 
     def get_pmachines(self):
         return [MockPMachine()]
 
 
-class MOCK_log():
+class MOCK_log(object):
 
     def debug(self, *args, **kwargs):
         pass
@@ -167,21 +167,21 @@ class MOCK_log():
         pass
 
 
-class MOCK_Context():
+class MOCK_Context(object):
     pass
 
 
-class MOCK_ImageService():
+class MOCK_ImageService(object):
     pass
 
 
-class MOCK_ImageUtils():
+class MOCK_ImageUtils(object):
     def fetch_to_raw(self, context, image_service, image_id, destination_path,
                      block_size, size, run_as_root=False):
         CALLED['ImageUtils_fetch_to_raw'] = (destination_path, size)
 
 
-class MOCK_volume():
+class MOCK_volume(object):
     host = MOCK_hostname
     size = MOCK_volume_size
     volume_type_id = MOCK_volume_type_id
@@ -205,31 +205,31 @@ class MOCK_volume():
         return getattr(self, attribute)
 
 
-class MOCK_snapshot():
+class MOCK_snapshot(object):
     volume = MOCK_volume()
     display_name = MOCK_snapshot_display_name
     id = MOCK_snapshot_id
 
 
 # Fake Modules
-class vdiskhybrid():
+class vdiskhybrid(object):
     VDisk = MockVDisk
 
 
-class pmachinelist():
+class pmachinelist(object):
     PMachineList = MockPMachineList()
 
 
-class vdisklist():
+class vdisklist(object):
     def __init__(self, vdisks):
         self.VDiskList = MockVDiskList(vdisks)
 
 
-class vpoollist():
+class vpoollist(object):
     VPoolList = MockVPoolList()
 
 
-class vdisklib():
+class vdisklib(object):
     VDiskController = MockVDiskController()
 
 
index 70fa065bb484b8120b073af647f9af3ba23fb6c4..a171b18d4a2bdd002819d17f9dd3fc7a79ecf94b 100644 (file)
@@ -50,7 +50,7 @@ Epoch Time           Version
 """
 
 
-class FakeImageService:
+class FakeImageService(object):
     def download(self, context, image_id, path):
         pass
 
@@ -107,7 +107,7 @@ class SheepdogTestCase(test.TestCase):
     def test_copy_image_to_volume(self):
         @contextlib.contextmanager
         def fake_temp_file():
-            class FakeTmp:
+            class FakeTmp(object):
                 def __init__(self, name):
                     self.name = name
             yield FakeTmp('test').name
index 4c00b38ab1a4db5023f8c6c987a143f1c36dade9..4312ee5aaf21d9dab17755e53f63b14a13cd153b 100644 (file)
@@ -45,7 +45,7 @@ from cinder.volume import volume_types
 LOG = logging.getLogger(__name__)
 
 
-class StorwizeSVCManagementSimulator:
+class StorwizeSVCManagementSimulator(object):
     def __init__(self, pool_name):
         self._flags = {'storwize_svc_volpool_name': pool_name}
         self._volumes_list = {}
index 21ea0c9c3afa5b8dff936c5a82d2febb95c93eee..ef71eed11b279f5c837b1822d3f09eef9b983d76 100644 (file)
@@ -485,8 +485,7 @@ class GenericUtilsTestCase(test.TestCase):
 
     @mock.patch('os.stat')
     def test_get_file_mode(self, mock_stat):
-
-        class stat_result:
+        class stat_result(object):
             st_mode = 0o777
             st_gid = 33333
 
@@ -499,7 +498,7 @@ class GenericUtilsTestCase(test.TestCase):
     @mock.patch('os.stat')
     def test_get_file_gid(self, mock_stat):
 
-        class stat_result:
+        class stat_result(object):
             st_mode = 0o777
             st_gid = 33333
 
@@ -654,7 +653,7 @@ class GetBlkdevMajorMinorTestCase(test.TestCase):
     @mock.patch('os.stat')
     def test_get_file_size(self, mock_stat):
 
-        class stat_result:
+        class stat_result(object):
             st_mode = 0o777
             st_size = 1074253824
 
@@ -667,7 +666,7 @@ class GetBlkdevMajorMinorTestCase(test.TestCase):
     @mock.patch('os.stat')
     def test_get_blkdev_major_minor(self, mock_stat):
 
-        class stat_result:
+        class stat_result(object):
             st_mode = 0o60660
             st_rdev = os.makedev(253, 7)
 
@@ -688,14 +687,14 @@ class GetBlkdevMajorMinorTestCase(test.TestCase):
         test_file = '/tmp/file'
         test_disk = '/dev/made_up_disk'
 
-        class stat_result_file:
+        class stat_result_file(object):
             st_mode = 0o660
 
-        class stat_result_partition:
+        class stat_result_partition(object):
             st_mode = 0o60660
             st_rdev = os.makedev(8, 65)
 
-        class stat_result_disk:
+        class stat_result_disk(object):
             st_mode = 0o60660
             st_rdev = os.makedev(8, 64)
 
index fc511040e61d3f9f454116906dc7693acf5cacbc..11f5d1d3757b464a56791db572ccc26a7bd30628 100644 (file)
@@ -83,7 +83,7 @@ fake_opt = [
 FAKE_UUID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa'
 
 
-class FakeImageService:
+class FakeImageService(object):
     def __init__(self, db_driver=None, image_service=None):
         pass
 
index b29026edf16c5e29bbcfd3efc2a4b27749f4eba1..3252df1e181223f451b8996908422844b19283d6 100644 (file)
@@ -26,7 +26,7 @@ from cinder import utils
 LOG = logging.getLogger("cinder.volume.driver")
 
 
-class HusBackend:
+class HusBackend(object):
     """Back end. Talks to HUS."""
     def get_version(self, cmd, ver, ip0, ip1, user, pw):
         out, err = utils.execute(cmd,
index 18ce0103ed9cd4f10a2b35eb182ef01504905963..92acfd3978c5ea618ad615015379ad9530c89ea3 100644 (file)
@@ -400,7 +400,7 @@ def _connection_checker(func):
     return inner_connection_checker
 
 
-class NimbleAPIExecutor:
+class NimbleAPIExecutor(object):
 
     """Makes Nimble API calls."""
 
index 85cc4979a404ec0dae63853d61bd88b39aa69c05..09f18b32d7cf44069d6d3882463a7299438141cb 100644 (file)
@@ -59,7 +59,7 @@ ACCEPTED_REST_SERVER = re.compile(r'^http://'
                                   '(:\d+)?/[a-zA-Z0-9\-_\/]*$')
 
 
-class retry:
+class retry(object):
     SLEEP_NONE = 'none'
     SLEEP_DOUBLE = 'double'
     SLEEP_INCREMENT = 'increment'
index 84cab530860c93c70c95f17ed6bda33e0f5850da..60225d04b065fe930c20650b25486be8c5db4490 100644 (file)
@@ -150,7 +150,7 @@ def _get_volume_type_extra_spec(type_id, spec_key, possible_values=None,
     LOG.debug("Invalid spec value: %s specified.", spec_value)
 
 
-class ImageDiskType:
+class ImageDiskType(object):
     """Supported disk types in images."""
 
     PREALLOCATED = "preallocated"
diff --git a/tox.ini b/tox.ini
index 6a991857dd757b5036299ad9f157d0b3db60bf25..3060c8ad87a734191370a61e2cb2e4cbe12a5009 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -62,11 +62,10 @@ commands = python setup.py build_sphinx
 # Due to the upgrade to hacking 0.10.0 the following checking are
 # ignored on purpose for the moment and should be cleaned up and re-enabled.
 #
-#  H238  old style class declaration, use new style (inherit from `object`)
 #  H105  Don't use author tags
 #
 
-ignore = E251,H405,H238,H105
+ignore = E251,H405,H105
 exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build
 max-complexity=30