From beefb313dc4cc76d432a2314966203f95067f016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 18 Aug 2023 00:14:25 +0200 Subject: [PATCH] Make pylint happy - disable superfluous-parens - drop disable=no-self-use as it's moved to optional extension - fix one too broad exception --- .pylintrc | 1 + qubesadmin/app.py | 2 +- qubesadmin/tools/__init__.py | 1 - qubesadmin/tools/dochelpers.py | 2 -- qubesadmin/tools/qvm_ls.py | 1 - qubesadmin/tools/qvm_start_daemon.py | 2 -- qubesadmin/tools/qvm_template.py | 4 +++- 7 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.pylintrc b/.pylintrc index 54ddaaf0..5a531605 100644 --- a/.pylintrc +++ b/.pylintrc @@ -22,6 +22,7 @@ disable= consider-using-set-comprehension, consider-using-dict-comprehension, consider-using-f-string, + superfluous-parens, not-an-iterable [REPORTS] diff --git a/qubesadmin/app.py b/qubesadmin/app.py index 3c527963..5c36fc08 100644 --- a/qubesadmin/app.py +++ b/qubesadmin/app.py @@ -662,7 +662,7 @@ def _update_power_state_cache(self, subject, event, **kwargs): :param event: name of the event :param kwargs: other arguments :return: - """ # pylint: disable=unused-argument,no-self-use + """ # pylint: disable=unused-argument if not self.app.cache_enabled: return diff --git a/qubesadmin/tools/__init__.py b/qubesadmin/tools/__init__.py index 59836465..8f2c1416 100644 --- a/qubesadmin/tools/__init__.py +++ b/qubesadmin/tools/__init__.py @@ -442,7 +442,6 @@ def set_qubes_verbosity(namespace): elif verbose >= 1: qubesadmin.log.enable() - # pylint: disable=no-self-use def print_error(self, *args, **kwargs): ''' Print to ``sys.stderr``''' print(*args, file=sys.stderr, **kwargs) diff --git a/qubesadmin/tools/dochelpers.py b/qubesadmin/tools/dochelpers.py index 7c4cfd98..3a24f9fd 100644 --- a/qubesadmin/tools/dochelpers.py +++ b/qubesadmin/tools/dochelpers.py @@ -121,7 +121,6 @@ def __init__(self, command, args, document): def visit_desc(self, node): """ Skips all but 'option' elements """ - # pylint: disable=no-self-use if not node.get('desctype', None) == 'option': raise docutils.nodes.SkipChildren @@ -172,7 +171,6 @@ def visit_section(self, node): Uses :py:class:`OptionsCheckVisitor` for checking sub-commands options """ - # pylint: disable=no-self-use title = str(node[0][0]) if title.upper() == SUBCOMMANDS_TITLE: return diff --git a/qubesadmin/tools/qvm_ls.py b/qubesadmin/tools/qvm_ls.py index e5d7add7..573867e9 100644 --- a/qubesadmin/tools/qvm_ls.py +++ b/qubesadmin/tools/qvm_ls.py @@ -196,7 +196,6 @@ def helper(self, vm): class FlagsColumn(Column): '''Some fancy flags that describe general status of the domain.''' - # pylint: disable=no-self-use def __init__(self): super().__init__(head='FLAGS', doc=self.__class__.__doc__) diff --git a/qubesadmin/tools/qvm_start_daemon.py b/qubesadmin/tools/qvm_start_daemon.py index 9832b1db..be4a2025 100644 --- a/qubesadmin/tools/qvm_start_daemon.py +++ b/qubesadmin/tools/qvm_start_daemon.py @@ -349,7 +349,6 @@ async def send_monitor_layout(self, vm, layout=None, startup=False): :param startup: :return: None """ - # pylint: disable=no-self-use if vm.features.check_with_template('no-monitor-layout', False) \ or not vm.is_running(): return @@ -548,7 +547,6 @@ async def start_audio_for_vm(self, vm): :param vm: VM for which start AUDIO daemon """ - # pylint: disable=no-self-use pacat_cmd = [PACAT_DAEMON_PATH, '-l', self.pacat_domid(vm), vm.name] vm.log.info('Starting AUDIO') diff --git a/qubesadmin/tools/qvm_template.py b/qubesadmin/tools/qvm_template.py index 72d77687..641c9523 100644 --- a/qubesadmin/tools/qvm_template.py +++ b/qubesadmin/tools/qvm_template.py @@ -44,6 +44,7 @@ import rpm import qubesadmin +import qubesadmin.exc import qubesadmin.vm import qubesadmin.utils import qubesadmin.tools @@ -1087,7 +1088,8 @@ def verify(rpmfile, reponame, package_hdr=None): with tempfile.TemporaryDirectory(dir=TEMP_DIR) as target: print(f'Installing template \'{name}\'...', file=sys.stderr) if not extract_rpm(name, rpmfile, target): - raise Exception(f'Failed to extract {name} template') + raise qubesadmin.exc.QubesException( + f'Failed to extract {name} template') cmdline = [ 'qvm-template-postprocess', '--really',