Parcourir la source

Make pylint happy

Fix thing detected by updated pylint in Travis-CI
Marek Marczykowski-Górecki il y a 6 ans
Parent
commit
32c6083e1c

+ 1 - 1
qubes/api/__init__.py

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

+ 2 - 1
qubes/backup.py

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

+ 1 - 0
qubes/core2migration.py

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

+ 2 - 1
qubes/storage/file.py

@@ -337,6 +337,7 @@ class FileVolume(qubes.storage.Volume):
             return 'block-origin'
         elif self.snap_on_start:
             return 'block-snapshot'
+        return None
 
     def block_device(self):
         ''' Return :py:class:`qubes.storage.BlockDevice` for serialization in
@@ -379,7 +380,7 @@ class FileVolume(qubes.storage.Volume):
 def create_sparse_file(path, size):
     ''' Create an empty sparse file '''
     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)
     if not os.path.exists(parent_dir):
         os.makedirs(parent_dir)

+ 1 - 0
qubes/storage/kernels.py

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

+ 2 - 1
qubes/storage/lvm.py

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

+ 1 - 1
qubes/vm/mix/net.py

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

+ 2 - 2
qubes/vm/qubesvm.py

@@ -835,7 +835,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
             # Intentionally not used is_running(): eliminate also "Paused",
             # "Crashed", "Halting"
             if self.get_power_state() != 'Halted':
-                return
+                return self
 
             with (yield from self._domain_stopped_lock):
                 # 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
 
         if not qmemman_present:
-            return
+            return None
 
         if mem_required is None:
             if self.virt_mode == 'hvm':

+ 1 - 2
qubespolicy/utils.py

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