Skip to content

Commit 4aadbf0

Browse files
committed
chore(pylintrc): get rid of E1120 errors for LINSTOR using signature-mutators
Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.tech>
1 parent bc51de0 commit 4aadbf0

3 files changed

Lines changed: 8 additions & 16 deletions

File tree

drivers/LinstorSR.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ def attach_thin(session, journaler, linstor, sr_uuid, vdi_uuid):
149149
# If the virtual VHD size is lower than the LINSTOR volume size,
150150
# there is nothing to do.
151151
vhd_size = LinstorVhdUtil.compute_volume_size(
152-
# TODO: Replace pylint comment with this feature when possible:
153-
# https://github.com/PyCQA/pylint/pull/2926
154-
LinstorVhdUtil(session, linstor).get_size_virt(vdi_uuid), # pylint: disable = E1120
152+
LinstorVhdUtil(session, linstor).get_size_virt(vdi_uuid),
155153
image_type
156154
)
157155

@@ -194,9 +192,7 @@ def check_vbd_count():
194192
device_path = linstor.get_device_path(vdi_uuid)
195193
vhdutil_inst = LinstorVhdUtil(session, linstor)
196194
new_volume_size = LinstorVolumeManager.round_up_volume_size(
197-
# TODO: Replace pylint comment with this feature when possible:
198-
# https://github.com/PyCQA/pylint/pull/2926
199-
vhdutil_inst.get_size_phys(vdi_uuid) # pylint: disable = E1120
195+
vhdutil_inst.get_size_phys(vdi_uuid)
200196
)
201197

202198
volume_info = linstor.get_volume_info(vdi_uuid)
@@ -1203,9 +1199,7 @@ def _load_vdis_ex(self):
12031199
self.vdis[vdi_uuid] = vdi
12041200

12051201
if USE_KEY_HASH and vdi.vdi_type == vhdutil.VDI_TYPE_VHD:
1206-
# TODO: Replace pylint comment with this feature when possible:
1207-
# https://github.com/PyCQA/pylint/pull/2926
1208-
vdi.sm_config_override['key_hash'] = self._vhdutil.get_key_hash(vdi_uuid) # pylint: disable = E1120
1202+
vdi.sm_config_override['key_hash'] = self._vhdutil.get_key_hash(vdi_uuid)
12091203

12101204
# 4.c. Update CBT status of disks either just added
12111205
# or already in XAPI.

drivers/linstorvhdutil.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def check(self, vdi_uuid, ignore_missing_footer=False, fast=False):
214214
'fast': fast
215215
}
216216
try:
217-
self._check(vdi_uuid, **kwargs) # pylint: disable = E1123
217+
self._check(vdi_uuid, **kwargs)
218218
return True
219219
except Exception as e:
220220
util.SMlog('Call to `check` failed: {}'.format(e))
@@ -229,9 +229,7 @@ def get_vhd_info(self, vdi_uuid, include_parent=True):
229229
'includeParent': include_parent,
230230
'resolveParent': False
231231
}
232-
# TODO: Replace pylint comment with this feature when possible:
233-
# https://github.com/PyCQA/pylint/pull/2926
234-
return self._get_vhd_info(vdi_uuid, self._extract_uuid, **kwargs) # pylint: disable = E1123
232+
return self._get_vhd_info(vdi_uuid, self._extract_uuid, **kwargs)
235233

236234
@linstorhostcall(vhdutil.getVHDInfo, 'getVHDInfo')
237235
def _get_vhd_info(self, vdi_uuid, response):
@@ -345,9 +343,7 @@ def inflate(self, journaler, vdi_uuid, vdi_path, new_size, old_size):
345343
)
346344
self._linstor.resize_volume(vdi_uuid, new_size)
347345

348-
# TODO: Replace pylint comment with this feature when possible:
349-
# https://github.com/PyCQA/pylint/pull/2926
350-
result_size = self.get_drbd_size(vdi_uuid) # pylint: disable = E1120
346+
result_size = self.get_drbd_size(vdi_uuid)
351347
if result_size < new_size:
352348
util.SMlog(
353349
'WARNING: Cannot inflate volume to {}B, result size: {}B'

tests/pylintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ generated-members=REQUEST,acl_users,aq_parent,linstor.*
9292
# # supports qualified module names, as well as Unix pattern matching.
9393
ignored-modules=bitarray
9494

95+
# List of decorators that change the signature of a decorated function.
96+
signature-mutators=linstorvhdutil.linstorhostcall
9597

9698
[SIMILARITIES]
9799

0 commit comments

Comments
 (0)