Make pylint happy

Fix thing detected by updated pylint in Travis-CI
This commit is contained in:
Marek Marczykowski-Górecki 2017-12-21 18:19:10 +01:00
parent f5fe10e2ad
commit 32c6083e1c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
9 changed files with 13 additions and 9 deletions

View File

@ -244,7 +244,7 @@ class QubesDaemonProtocol(asyncio.Protocol):
except ValueError: except ValueError:
self.app.log.warning('framing error') self.app.log.warning('framing error')
self.transport.abort() self.transport.abort()
return return None
finally: finally:
self.untrusted_buffer.close() self.untrusted_buffer.close()

View File

@ -851,11 +851,12 @@ def handle_streams(stream_in, stream_out, size_limit=None,
buf = yield from stream_in.read(to_copy) buf = yield from stream_in.read(to_copy)
if not buf: if not buf:
# done # done
return None break
if callable(progress_callback): if callable(progress_callback):
progress_callback(len(buf)) progress_callback(len(buf))
stream_out.write(buf) stream_out.write(buf)
bytes_copied += len(buf) bytes_copied += len(buf)
return None
# vim:sw=4:et: # vim:sw=4:et:

View File

@ -276,6 +276,7 @@ class Core2Qubes(qubes.Qubes):
if not lock: if not lock:
self._release_lock() self._release_lock()
return True
def save(self, lock=False): def save(self, lock=False):
raise NotImplementedError("Saving old qubes.xml not supported") raise NotImplementedError("Saving old qubes.xml not supported")

View File

@ -337,6 +337,7 @@ class FileVolume(qubes.storage.Volume):
return 'block-origin' return 'block-origin'
elif self.snap_on_start: elif self.snap_on_start:
return 'block-snapshot' return 'block-snapshot'
return None
def block_device(self): def block_device(self):
''' Return :py:class:`qubes.storage.BlockDevice` for serialization in ''' Return :py:class:`qubes.storage.BlockDevice` for serialization in
@ -379,7 +380,7 @@ class FileVolume(qubes.storage.Volume):
def create_sparse_file(path, size): def create_sparse_file(path, size):
''' Create an empty sparse file ''' ''' Create an empty sparse file '''
if os.path.exists(path): if os.path.exists(path):
raise IOError("Volume %s already exists", path) raise IOError("Volume %s already exists" % path)
parent_dir = os.path.dirname(path) parent_dir = os.path.dirname(path)
if not os.path.exists(parent_dir): if not os.path.exists(parent_dir):
os.makedirs(parent_dir) os.makedirs(parent_dir)

View File

@ -123,6 +123,7 @@ class LinuxModules(Volume):
def block_device(self): def block_device(self):
if self.vid: if self.vid:
return super().block_device() return super().block_device()
return None
class LinuxKernel(Pool): class LinuxKernel(Pool):

View File

@ -238,7 +238,7 @@ class ThinVolume(qubes.storage.Volume):
''' Resets a volatile volume ''' ''' Resets a volatile volume '''
assert not self.snap_on_start and not self.save_on_stop, \ assert not self.snap_on_start and not self.save_on_stop, \
"Not a volatile volume" "Not a volatile volume"
self.log.debug('Resetting volatile ' + self.vid) self.log.debug('Resetting volatile %s', self.vid)
try: try:
cmd = ['remove', self.vid] cmd = ['remove', self.vid]
qubes_lvm(cmd, self.log) qubes_lvm(cmd, self.log)
@ -493,6 +493,7 @@ class ThinVolume(qubes.storage.Volume):
except KeyError: except KeyError:
raise qubes.storage.StoragePoolException( raise qubes.storage.StoragePoolException(
'volume {} missing'.format(vid)) 'volume {} missing'.format(vid))
return True
def block_device(self): def block_device(self):

View File

@ -66,7 +66,7 @@ def _default_ip6(self):
def _setter_netvm(self, prop, value): def _setter_netvm(self, prop, value):
# pylint: disable=unused-argument # pylint: disable=unused-argument
if value is None: if value is None:
return return None
if not value.provides_network: if not value.provides_network:
raise qubes.exc.QubesValueError( raise qubes.exc.QubesValueError(
'The {!s} qube does not provide network'.format(value)) 'The {!s} qube does not provide network'.format(value))

View File

@ -835,7 +835,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
# Intentionally not used is_running(): eliminate also "Paused", # Intentionally not used is_running(): eliminate also "Paused",
# "Crashed", "Halting" # "Crashed", "Halting"
if self.get_power_state() != 'Halted': if self.get_power_state() != 'Halted':
return return self
with (yield from self._domain_stopped_lock): with (yield from self._domain_stopped_lock):
# Don't accept any new stopped event's till a new VM has been # Don't accept any new stopped event's till a new VM has been
@ -1229,7 +1229,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
# add an extra MB because Nova rounds up to MBs # add an extra MB because Nova rounds up to MBs
if not qmemman_present: if not qmemman_present:
return return None
if mem_required is None: if mem_required is None:
if self.virt_mode == 'hvm': if self.virt_mode == 'hvm':

View File

@ -46,7 +46,6 @@ def _sanitize_name(input_string, extra_allowed_characters, assert_sanitized):
if assert_sanitized: if assert_sanitized:
assert input_string == result, \ assert input_string == result, \
'Input string was expected to be sanitized, but was not.' 'Input string was expected to be sanitized, but was not.'
else:
return result return result