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