Skip to content

Commit 019f9db

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 89a1faf commit 019f9db

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
@@ -150,9 +150,7 @@ def attach_thin(session, journaler, linstor, sr_uuid, vdi_uuid):
150150
# If the virtual VHD size is lower than the LINSTOR volume size,
151151
# there is nothing to do.
152152
vhd_size = LinstorVhdUtil.compute_volume_size(
153-
# TODO: Replace pylint comment with this feature when possible:
154-
# https://github.com/PyCQA/pylint/pull/2926
155-
LinstorVhdUtil(session, linstor).get_size_virt(vdi_uuid), # pylint: disable = E1120
153+
LinstorVhdUtil(session, linstor).get_size_virt(vdi_uuid),
156154
image_type
157155
)
158156

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

203199
volume_info = linstor.get_volume_info(vdi_uuid)
@@ -1210,9 +1206,7 @@ def _load_vdis_ex(self):
12101206
self.vdis[vdi_uuid] = vdi
12111207

12121208
if USE_KEY_HASH and vdi.vdi_type == vhdutil.VDI_TYPE_VHD:
1213-
# TODO: Replace pylint comment with this feature when possible:
1214-
# https://github.com/PyCQA/pylint/pull/2926
1215-
vdi.sm_config_override['key_hash'] = self._vhdutil.get_key_hash(vdi_uuid) # pylint: disable = E1120
1209+
vdi.sm_config_override['key_hash'] = self._vhdutil.get_key_hash(vdi_uuid)
12161210

12171211
# 4.c. Update CBT status of disks either just added
12181212
# 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)