Fix pylint warning len-as-conditional
This commit is contained in:
parent
9da28c9c15
commit
eb217e0d27
@ -480,7 +480,7 @@ class VMCollection(object):
|
||||
# if not self[netvm_qid].is_netvm():
|
||||
# return set([])
|
||||
|
||||
while len(new_vms) > 0:
|
||||
while new_vms:
|
||||
cur_vm = new_vms.pop()
|
||||
for vm in cur_vm.connected_vms:
|
||||
if vm in dependent_vms:
|
||||
|
@ -234,7 +234,7 @@ class DeviceCollection(object):
|
||||
DeviceAssignment(backend_domain=dev.backend_domain,
|
||||
ident=dev.ident, options=options,
|
||||
frontend_domain=self._vm))
|
||||
if persistent is not False and len(result) == 0:
|
||||
if persistent is not False and not result:
|
||||
result.extend(self._set)
|
||||
return result
|
||||
|
||||
|
@ -38,7 +38,7 @@ class TarSparseInfo(tarfile.TarInfo):
|
||||
|
||||
@property
|
||||
def realsize(self):
|
||||
if len(self.sparsemap):
|
||||
if self.sparsemap:
|
||||
return self.sparsemap[-1][0] + self.sparsemap[-1][1]
|
||||
else:
|
||||
return self.size
|
||||
|
@ -257,8 +257,8 @@ class VolumeAction(QubesAction):
|
||||
try:
|
||||
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:
|
||||
assert len(volume) == 1, 'Duplicate vids in pool %s' % pool_name
|
||||
if not volume:
|
||||
parser.error_runtime(
|
||||
'no volume with id {!r} pool: {!r}'.format(vid,
|
||||
pool_name))
|
||||
|
@ -38,7 +38,7 @@ parser.add_argument("--template", action="store_true", dest="template",
|
||||
|
||||
|
||||
def print_msg(domains, what_single, what_plural):
|
||||
if len(domains) == 0:
|
||||
if not domains:
|
||||
print("None of given VM {!s}".format(what_single))
|
||||
elif len(domains) == 1:
|
||||
print("VM {!s} {!s}".format(domains[0], what_single))
|
||||
|
@ -84,7 +84,7 @@ def list_pools(app):
|
||||
''' Prints out all known pools and their drivers '''
|
||||
result = [('NAME', 'DRIVER')]
|
||||
for pool in app.pools.values():
|
||||
if len(pool.volumes) == 0 and issubclass(
|
||||
if not pool.volumes and issubclass(
|
||||
pool.__class__, qubes.storage.domain.DomainPool):
|
||||
# skip empty DomainPools
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user