storage: modernize super() syntax

This commit is contained in:
Rusty Bird 2020-06-22 14:03:20 +00:00
parent c2ce28936e
commit 652bf3b6d9
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF
4 changed files with 9 additions and 11 deletions

View File

@ -99,7 +99,7 @@ class Volume:
''' '''
super(Volume, self).__init__(**kwargs) super().__init__(**kwargs)
assert isinstance(pool, Pool) assert isinstance(pool, Pool)
assert source is None or (isinstance(source, Volume) assert source is None or (isinstance(source, Volume)
and source.pool == pool) and source.pool == pool)
@ -717,7 +717,7 @@ class Pool:
root_img_size = qubes.config.defaults['root_img_size'] root_img_size = qubes.config.defaults['root_img_size']
def __init__(self, name, revisions_to_keep=1, **kwargs): def __init__(self, name, revisions_to_keep=1, **kwargs):
super(Pool, self).__init__(**kwargs) super().__init__(**kwargs)
self._volumes_collection = VolumesCollection(self) self._volumes_collection = VolumesCollection(self)
self.name = name self.name = name
self.revisions_to_keep = revisions_to_keep self.revisions_to_keep = revisions_to_keep

View File

@ -53,8 +53,7 @@ class FilePool(qubes.storage.Pool):
driver = 'file' driver = 'file'
def __init__(self, revisions_to_keep=1, dir_path=None, **kwargs): def __init__(self, revisions_to_keep=1, dir_path=None, **kwargs):
super(FilePool, self).__init__(revisions_to_keep=revisions_to_keep, super().__init__(revisions_to_keep=revisions_to_keep, **kwargs)
**kwargs)
assert dir_path, "No pool dir_path specified" assert dir_path, "No pool dir_path specified"
self.dir_path = os.path.normpath(dir_path) self.dir_path = os.path.normpath(dir_path)
self._volumes = [] self._volumes = []
@ -182,7 +181,7 @@ class FileVolume(qubes.storage.Volume):
self.dir_path = dir_path self.dir_path = dir_path
assert self.dir_path, "dir_path not specified" assert self.dir_path, "dir_path not specified"
self._revisions_to_keep = 0 self._revisions_to_keep = 0
super(FileVolume, self).__init__(**kwargs) super().__init__(**kwargs)
if self.snap_on_start: if self.snap_on_start:
img_name = self.source.vid + '-cow.img' img_name = self.source.vid + '-cow.img'

View File

@ -33,7 +33,7 @@ class LinuxModules(Volume):
def __init__(self, target_dir, kernel_version, **kwargs): def __init__(self, target_dir, kernel_version, **kwargs):
kwargs['vid'] = '' kwargs['vid'] = ''
super(LinuxModules, self).__init__(**kwargs) super().__init__(**kwargs)
self._kernel_version = kernel_version self._kernel_version = kernel_version
self.target_dir = target_dir self.target_dir = target_dir
assert self.revisions_to_keep == 0 assert self.revisions_to_keep == 0
@ -156,7 +156,7 @@ class LinuxKernel(Pool):
def __init__(self, name=None, dir_path=None): def __init__(self, name=None, dir_path=None):
assert dir_path, 'Missing dir_path' assert dir_path, 'Missing dir_path'
super(LinuxKernel, self).__init__(name=name, revisions_to_keep=0) super().__init__(name=name, revisions_to_keep=0)
self.dir_path = dir_path self.dir_path = dir_path
def init_volume(self, vm, volume_config): def init_volume(self, vm, volume_config):

View File

@ -81,8 +81,7 @@ class ThinPool(qubes.storage.Pool):
driver = 'lvm_thin' driver = 'lvm_thin'
def __init__(self, volume_group, thin_pool, revisions_to_keep=1, **kwargs): def __init__(self, volume_group, thin_pool, revisions_to_keep=1, **kwargs):
super(ThinPool, self).__init__(revisions_to_keep=revisions_to_keep, super().__init__(revisions_to_keep=revisions_to_keep, **kwargs)
**kwargs)
self.volume_group = volume_group self.volume_group = volume_group
self.thin_pool = thin_pool self.thin_pool = thin_pool
self._pool_id = "{!s}/{!s}".format(volume_group, thin_pool) self._pool_id = "{!s}/{!s}".format(volume_group, thin_pool)
@ -316,7 +315,7 @@ class ThinVolume(qubes.storage.Volume):
def __init__(self, volume_group, **kwargs): def __init__(self, volume_group, **kwargs):
self.volume_group = volume_group self.volume_group = volume_group
super(ThinVolume, self).__init__(**kwargs) super().__init__(**kwargs)
self.log = logging.getLogger('qubes.storage.lvm.%s' % str(self.pool)) self.log = logging.getLogger('qubes.storage.lvm.%s' % str(self.pool))
if self.snap_on_start or self.save_on_stop: if self.snap_on_start or self.save_on_stop:
@ -742,7 +741,7 @@ class ThinVolume(qubes.storage.Volume):
'/dev/' + self._vid_snap, self.name, self.script, '/dev/' + self._vid_snap, self.name, self.script,
self.rw, self.domain, self.devtype) self.rw, self.domain, self.devtype)
return super(ThinVolume, self).block_device() return super().block_device()
@property @property
def usage(self): # lvm thin usage always returns at least the same usage as def usage(self): # lvm thin usage always returns at least the same usage as