From 43fca80a5b507cda6eb2aedf038e0c150b5faa82 Mon Sep 17 00:00:00 2001 From: 3hhh Date: Sun, 5 Jul 2020 19:44:30 +0200 Subject: [PATCH] storage/callback: fix issues detected by pylint --- qubes/storage/callback.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qubes/storage/callback.py b/qubes/storage/callback.py index 574062d0..fff9f01e 100644 --- a/qubes/storage/callback.py +++ b/qubes/storage/callback.py @@ -427,12 +427,13 @@ class CallbackVolume(qubes.storage.Volume): :param pool: `CallbackPool` of this volume :param impl: `qubes.storage.Volume` object to wrap ''' + # pylint: disable=super-init-not-called + #NOTE: we must *not* call super().__init__() as it would prevent attribute delegation assert isinstance(impl, qubes.storage.Volume), 'impl must be a qubes.storage.Volume instance. Found a %s instance.' % impl.__class__ assert isinstance(pool, CallbackPool), 'pool must use a qubes.storage.CallbackPool instance. Found a %s instance.' % pool.__class__ impl.pool = pool #enforce the CallbackPool instance as the parent pool of the volume self._cb_pool = pool #: CallbackPool instance the Volume belongs to. self._cb_impl = impl #: Backend volume implementation instance. - #NOTE: we must *not* call super().__init__() as it would prevent attribute delegation @asyncio.coroutine def _assert_initialized(self, **kwargs): @@ -480,10 +481,10 @@ class CallbackVolume(qubes.storage.Volume): return ret @asyncio.coroutine - def import_data(self): + def import_data(self, size): yield from self._assert_initialized() - yield from self._callback('pre_volume_import_data') - return (yield from coro_maybe(self._cb_impl.import_data())) + yield from self._callback('pre_volume_import_data', cb_args=[size]) + return (yield from coro_maybe(self._cb_impl.import_data(size))) @asyncio.coroutine def import_data_end(self, success): @@ -534,12 +535,12 @@ class CallbackVolume(qubes.storage.Volume): return None return self._cb_impl.block_device() - def export(self, volume): + def export(self): # pylint: disable=protected-access #TODO: once this becomes a coroutine in the Volume class, avoid the below blocking & potentially exception-throwing code; maybe also add a callback if self._cb_pool._cb_requires_init: self._cb_pool._init_nocoro() - return self._cb_impl.export(volume) + return self._cb_impl.export() @asyncio.coroutine def verify(self):