Skip to content

Commit 38ea04f

Browse files
committed
chore(pylintrc): get rid of E1120 errors for LINSTOR using signature-mutators
Signed-off-by: Ronan Abhamon <[email protected]>
1 parent 22a6887 commit 38ea04f

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

drivers/LinstorSR.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,7 @@ def attach_thin(session, journaler, linstor, sr_uuid, vdi_uuid):
161161
# If the virtual COW size is lower than the LINSTOR volume size,
162162
# there is nothing to do.
163163
cow_size = linstorcowutil.compute_volume_size(
164-
# TODO: Replace pylint comment with this feature when possible:
165-
# https://github.com/PyCQA/pylint/pull/2926
166-
linstorcowutil.get_size_virt(vdi_uuid) # pylint: disable = E1120
164+
linstorcowutil.get_size_virt(vdi_uuid)
167165
)
168166

169167
volume_info = linstor.get_volume_info(vdi_uuid)
@@ -203,9 +201,7 @@ def check_vbd_count():
203201
device_path = linstor.get_device_path(vdi_uuid)
204202
linstorcowutil = LinstorCowUtil(session, linstor, vdi_type)
205203
new_volume_size = LinstorVolumeManager.round_up_volume_size(
206-
# TODO: Replace pylint comment with this feature when possible:
207-
# https://github.com/PyCQA/pylint/pull/2926
208-
linstorcowutil.get_size_phys(vdi_uuid) # pylint: disable = E1120
204+
linstorcowutil.get_size_phys(vdi_uuid)
209205
)
210206

211207
volume_info = linstor.get_volume_info(vdi_uuid)
@@ -1215,10 +1211,7 @@ def _load_vdis_ex(self):
12151211
self.vdis[vdi_uuid] = vdi
12161212

12171213
if USE_KEY_HASH and VdiType.isCowImage(vdi.vdi_type):
1218-
# TODO: Replace pylint comment with this feature when possible:
1219-
# https://github.com/PyCQA/pylint/pull/2926
1220-
vdi.sm_config_override['key_hash'] = \
1221-
vdi.linstorcowutil.get_key_hash(vdi_uuid) # pylint: disable = E1120
1214+
vdi.sm_config_override['key_hash'] = vdi.linstorcowutil.get_key_hash(vdi_uuid)
12221215

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

drivers/linstorcowutil.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def check(self, vdi_uuid, ignore_missing_footer=False, fast=False):
196196
'ignoreMissingFooter': ignore_missing_footer,
197197
'fast': fast
198198
}
199-
return self._check(vdi_uuid, **kwargs) # pylint: disable = E1123
199+
return self._check(vdi_uuid, **kwargs)
200200

201201
@linstorhostcall(CowUtil.check, 'check')
202202
def _check(self, vdi_uuid, response):
@@ -207,9 +207,7 @@ def get_info(self, vdi_uuid, include_parent=True):
207207
'includeParent': include_parent,
208208
'resolveParent': False
209209
}
210-
# TODO: Replace pylint comment with this feature when possible:
211-
# https://github.com/PyCQA/pylint/pull/2926
212-
return self._get_info(vdi_uuid, self._extract_uuid, **kwargs) # pylint: disable = E1123
210+
return self._get_info(vdi_uuid, self._extract_uuid, **kwargs)
213211

214212
@linstorhostcall(CowUtil.getInfo, 'getInfo')
215213
def _get_info(self, vdi_uuid, response):
@@ -323,9 +321,7 @@ def inflate(self, journaler, vdi_uuid, vdi_path, new_size, old_size):
323321
)
324322
self._linstor.resize_volume(vdi_uuid, new_size)
325323

326-
# TODO: Replace pylint comment with this feature when possible:
327-
# https://github.com/PyCQA/pylint/pull/2926
328-
result_size = self.get_drbd_size(vdi_uuid) # pylint: disable = E1120
324+
result_size = self.get_drbd_size(vdi_uuid)
329325
if result_size < new_size:
330326
util.SMlog(
331327
'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=linstorcowutil.linstorhostcall
9597

9698
[SIMILARITIES]
9799

0 commit comments

Comments
 (0)