Skip to content

Commit

Permalink
Make pylint happy after python-black
Browse files Browse the repository at this point in the history
  • Loading branch information
fepitre committed Nov 21, 2024
1 parent ba412a9 commit 039b7d3
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 21 deletions.
11 changes: 8 additions & 3 deletions qubes/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,9 @@ async def destroy(self):
raise self._not_implemented("destroy")

def init_volume(self, vm, volume_config):
"""Initialize a :py:class:`qubes.storage.Volume` from `volume_config`."""
"""
Initialize a :py:class:`qubes.storage.Volume` from `volume_config`.
"""
raise self._not_implemented("init_volume")

async def setup(self):
Expand Down Expand Up @@ -1039,7 +1041,8 @@ def _not_implemented(self, method_name):


def _sanitize_config(config):
"""Helper function to convert types to appropriate strings""" # FIXME: find another solution for serializing basic types
"""Helper function to convert types to appropriate strings"""
# FIXME: find another solution for serializing basic types
result = {}
for key, value in config.items():
if isinstance(value, bool):
Expand Down Expand Up @@ -1109,7 +1112,9 @@ def search_pool_containing_dir(pools, dir_path):


class VmCreationManager:
"""A `ContextManager` which cleans up if volume creation fails.""" # pylint: disable=too-few-public-methods
"""A `ContextManager` which cleans up if volume creation fails."""

# pylint: disable=too-few-public-methods

def __init__(self, vm):
self.vm = vm
Expand Down
10 changes: 4 additions & 6 deletions qubes/storage/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,15 @@ def __init__(self, pool, impl):
self._cb_impl = impl #: Backend volume implementation instance.

async def _assert_initialized(self, **kwargs):
await self._cb_pool._assert_initialized(
**kwargs
) # pylint: disable=protected-access
# pylint: disable=protected-access
await self._cb_pool._assert_initialized(**kwargs)

async def _callback(self, cb, cb_args=None, **kwargs):
if cb_args is None:
cb_args = []
vol_args = [self.name, self.vid, self.source, *cb_args]
await self._cb_pool._callback(
cb, cb_args=vol_args, **kwargs
) # pylint: disable=protected-access
# pylint: disable=protected-access
await self._cb_pool._callback(cb, cb_args=vol_args, **kwargs)

@property
def backend_class(self):
Expand Down
3 changes: 2 additions & 1 deletion qubes/storage/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ def setup(self): # pylint: disable=invalid-overridden-method

@staticmethod
def _vid_prefix(vm):
"""Helper to create a prefix for the vid for volume""" # FIX Remove this if we drop the file backend
"""Helper to create a prefix for the vid for volume"""
# FIXME: remove this if we drop the file backend
import qubes.vm.templatevm # pylint: disable=redefined-outer-name
import qubes.vm.dispvm # pylint: disable=redefined-outer-name

Expand Down
13 changes: 8 additions & 5 deletions qubes/storage/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ async def destroy(self):
pass # TODO Should we remove an existing pool?

def init_volume(self, vm, volume_config):
"""Initialize a :py:class:`qubes.storage.Volume` from `volume_config`."""
"""
Initialize a :py:class:`qubes.storage.Volume` from `volume_config`.
"""

if "revisions_to_keep" not in volume_config.keys():
volume_config["revisions_to_keep"] = self.revisions_to_keep
Expand Down Expand Up @@ -339,7 +341,9 @@ def _revision_sort_key(revision):


class ThinVolume(qubes.storage.Volume):
"""Default LVM thin volume implementation""" # pylint: disable=too-few-public-methods
"""Default LVM thin volume implementation"""

# pylint: disable=too-few-public-methods

def __init__(self, volume_group, **kwargs):
self.volume_group = volume_group
Expand Down Expand Up @@ -621,9 +625,8 @@ async def import_data(self, size):
"""Returns an object that can be `open()`."""
if self.is_dirty():
raise qubes.storage.StoragePoolException(
"Cannot import data to dirty volume {}, stop the qube first".format(
self.vid
)
"Cannot import data to dirty volume {},"
" stop the qube first".format(self.vid)
)
self.abort_if_import_in_progress()
# pylint: disable=protected-access
Expand Down
5 changes: 2 additions & 3 deletions qubes/storage/reflink.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,8 @@ def verify(self): # pylint: disable=invalid-overridden-method
@qubes.storage.Volume.locked
@_coroutinized
def remove(self): # pylint: disable=invalid-overridden-method
self.pool._volumes.pop(
self.vid, None
) # pylint: disable=protected-access
# pylint: disable=protected-access
self.pool._volumes.pop(self.vid, None)

Check warning on line 231 in qubes/storage/reflink.py

View check run for this annotation

Codecov / codecov/patch

qubes/storage/reflink.py#L231

Added line #L231 was not covered by tests
self._remove_all_images()
_remove_empty_dir(os.path.dirname(self._path_vid))
return self
Expand Down
4 changes: 3 additions & 1 deletion qubes/vm/mix/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ def visible_netmask(self):

@staticmethod
def get_ip_for_vm(vm):
"""Get IP address for (appvm) domain connected to this (netvm) domain."""
"""
Get IP address for (appvm) domain connected to this (netvm) domain.
"""
import qubes.vm.dispvm # pylint: disable=redefined-outer-name

if isinstance(vm, qubes.vm.dispvm.DispVM):
Expand Down
9 changes: 7 additions & 2 deletions qubes/vm/qubesvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@


def _setter_kernel(self, prop, value):
"""Helper for setting the domain kernel and running sanity checks on it.""" # pylint: disable=unused-argument
"""
Helper for setting the domain kernel and running sanity checks on it.
"""
# pylint: disable=unused-argument
if not value:
return ""
value = str(value)
Expand All @@ -77,7 +80,9 @@ def _setter_kernel(self, prop, value):


def _setter_kernelopts(self, prop, value):
"""Helper for setting the domain kernelopts and running sanity checks on it."""
"""
Helper for setting the domain kernelopts and running sanity checks on it.
"""
if not value:
return ""
value = str(value)
Expand Down

0 comments on commit 039b7d3

Please sign in to comment.