Make pylint happy
This commit is contained in:
parent
b6d06d856d
commit
275a53e545
@ -70,7 +70,7 @@ class PropertyHolder(object):
|
||||
raise appropriate exception.
|
||||
'''
|
||||
|
||||
if len(response_data) == 0:
|
||||
if response_data == b'':
|
||||
raise qubesmgmt.exc.QubesDaemonNoResponseError(
|
||||
'Got empty response from qubesd')
|
||||
|
||||
|
@ -90,18 +90,16 @@ class Volume(object):
|
||||
'''Storage volume pool name.'''
|
||||
if self._pool is not None:
|
||||
return self._pool
|
||||
else:
|
||||
self._fetch_info()
|
||||
return str(self._info['pool'])
|
||||
self._fetch_info()
|
||||
return str(self._info['pool'])
|
||||
|
||||
@property
|
||||
def vid(self):
|
||||
'''Storage volume id, unique within given pool.'''
|
||||
if self._vid is not None:
|
||||
return self._vid
|
||||
else:
|
||||
self._fetch_info()
|
||||
return str(self._info['vid'])
|
||||
self._fetch_info()
|
||||
return str(self._info['vid'])
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
@ -142,8 +140,7 @@ class Volume(object):
|
||||
self._fetch_info()
|
||||
if self._info['source']:
|
||||
return self._info['source']
|
||||
else:
|
||||
return None
|
||||
return None
|
||||
|
||||
@property
|
||||
def internal(self):
|
||||
|
@ -219,7 +219,7 @@ class VolumeAction(QubesAction):
|
||||
pool = app.pools[pool_name]
|
||||
volume = [v for v in pool.volumes if v.vid == vid]
|
||||
assert volume > 1, 'Duplicate vids in pool %s' % pool_name
|
||||
if len(volume) == 0:
|
||||
if not volume:
|
||||
parser.error_runtime(
|
||||
'no volume with id {!r} pool: {!r}'.format(vid,
|
||||
pool_name))
|
||||
@ -348,7 +348,7 @@ class QubesArgumentParser(argparse.ArgumentParser):
|
||||
|
||||
self.set_defaults(verbose=1, quiet=0)
|
||||
|
||||
def parse_args(self, *args, **kwargs):
|
||||
def parse_args(self, *args, **kwargs): # pylint: disable=arguments-differ
|
||||
# hack for tests
|
||||
app = kwargs.pop('app', None)
|
||||
namespace = super(QubesArgumentParser, self).parse_args(*args, **kwargs)
|
||||
@ -424,9 +424,8 @@ class AliasedSubParsersAction(argparse._SubParsersAction):
|
||||
super(AliasedSubParsersAction._AliasedPseudoAction, self).\
|
||||
__init__(option_strings=[], dest=dest, help=help)
|
||||
|
||||
def __call__(self, **kwargs):
|
||||
super(AliasedSubParsersAction._AliasedPseudoAction, self).__call__(
|
||||
**kwargs)
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
pass
|
||||
|
||||
def add_parser(self, name, **kwargs):
|
||||
if 'aliases' in kwargs:
|
||||
|
@ -228,8 +228,7 @@ class StatusColumn(Column):
|
||||
if ret is not None:
|
||||
if getattr(vm, 'hvm', False):
|
||||
return ret.upper()
|
||||
else:
|
||||
return ret
|
||||
return ret
|
||||
|
||||
|
||||
@flag(2)
|
||||
|
@ -149,7 +149,7 @@ def main(args=None, app=None):
|
||||
if not args.autostart and not vm.is_running():
|
||||
continue
|
||||
try:
|
||||
log.info('Running {!r} on {!s}'.format(args.cmd, vm.name))
|
||||
log.info('Running \'%s\' on %s', args.cmd, vm.name)
|
||||
if args.passio and not args.localcmd:
|
||||
loop = asyncio.new_event_loop()
|
||||
loop.add_signal_handler(signal.SIGCHLD, loop.stop)
|
||||
|
@ -72,7 +72,7 @@ class VolumeData(object):
|
||||
def __init__(self, volume):
|
||||
self.pool = volume.pool
|
||||
self.vid = volume.vid
|
||||
if len(volume.revisions) > 0:
|
||||
if volume.revisions:
|
||||
self.revisions = 'Yes'
|
||||
else:
|
||||
self.revisions = 'No'
|
||||
|
@ -81,24 +81,21 @@ def mbytes_to_kmg(size):
|
||||
'''Convert mbytes to human readable format.'''
|
||||
if size > 1024:
|
||||
return "%d GiB" % (size / 1024)
|
||||
else:
|
||||
return "%d MiB" % size
|
||||
return "%d MiB" % size
|
||||
|
||||
|
||||
def kbytes_to_kmg(size):
|
||||
'''Convert kbytes to human readable format.'''
|
||||
if size > 1024:
|
||||
return mbytes_to_kmg(size / 1024)
|
||||
else:
|
||||
return "%d KiB" % size
|
||||
return "%d KiB" % size
|
||||
|
||||
|
||||
def bytes_to_kmg(size):
|
||||
'''Convert bytes to human readable format.'''
|
||||
if size > 1024:
|
||||
return kbytes_to_kmg(size / 1024)
|
||||
else:
|
||||
return "%d B" % size
|
||||
return "%d B" % size
|
||||
|
||||
|
||||
def size_to_human(size):
|
||||
@ -109,8 +106,7 @@ def size_to_human(size):
|
||||
return str(round(size / 1024.0, 1)) + ' KiB'
|
||||
elif size < 1024 * 1024 * 1024:
|
||||
return str(round(size / (1024.0 * 1024), 1)) + ' MiB'
|
||||
else:
|
||||
return str(round(size / (1024.0 * 1024 * 1024), 1)) + ' GiB'
|
||||
return str(round(size / (1024.0 * 1024 * 1024), 1)) + ' GiB'
|
||||
|
||||
|
||||
def get_entry_point_one(group, name):
|
||||
|
Loading…
Reference in New Issue
Block a user