From 5d88e5f85110481efcd076a65cab9261964dd31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Thu, 26 Sep 2019 22:40:40 +0200 Subject: [PATCH] Pylint fixes Several minor fixes for updated pylint checker. --- qubesmanager/backup.py | 7 +------ qubesmanager/bootfromdevice.py | 1 + qubesmanager/firewall.py | 3 +-- qubesmanager/global_settings.py | 3 ++- qubesmanager/qube_manager.py | 2 +- qubesmanager/restore.py | 2 +- qubesmanager/utils.py | 4 ++-- 7 files changed, 9 insertions(+), 13 deletions(-) diff --git a/qubesmanager/backup.py b/qubesmanager/backup.py index 9be8354..97a02d9 100644 --- a/qubesmanager/backup.py +++ b/qubesmanager/backup.py @@ -25,9 +25,7 @@ from qubesadmin import exc from qubesadmin import utils as admin_utils from qubes.storage.file import get_disk_usage -from PyQt5 import QtCore # pylint: disable=import-error -from PyQt5 import QtWidgets # pylint: disable=import-error -from PyQt5 import QtGui +from PyQt5 import QtCore, QtWidgets, QtGui # pylint: disable=import-error from . import ui_backupdlg # pylint: disable=no-name-in-module from . import multiselectwidget @@ -36,10 +34,7 @@ from . import utils import grp import pwd -import sys import os -import asyncio -from contextlib import suppress # pylint: disable=too-few-public-methods diff --git a/qubesmanager/bootfromdevice.py b/qubesmanager/bootfromdevice.py index 24f9370..6377a78 100644 --- a/qubesmanager/bootfromdevice.py +++ b/qubesmanager/bootfromdevice.py @@ -33,6 +33,7 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, self.vm = vm self.qapp = qapp + self.qubesapp = qubesapp self.setupUi(self) self.setWindowTitle( diff --git a/qubesmanager/firewall.py b/qubesmanager/firewall.py index 3120dff..c224d46 100644 --- a/qubesmanager/firewall.py +++ b/qubesmanager/firewall.py @@ -326,8 +326,7 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel): if rule.action == 'accept': conf['rules'].insert(0, rule) continue - else: - raise FirewallModifiedOutsideError('No blacklist support.') + raise FirewallModifiedOutsideError('No blacklist support.') if rule.expire is not None and rule.dsthost is None \ and rule.proto is None: diff --git a/qubesmanager/global_settings.py b/qubesmanager/global_settings.py index 1b2d027..a2140f7 100644 --- a/qubesmanager/global_settings.py +++ b/qubesmanager/global_settings.py @@ -40,7 +40,8 @@ def _run_qrexec_repo(service, arg=''): p = subprocess.run( ['sudo', cmd, arg], stdout=subprocess.PIPE, - stderr=subprocess.PIPE + stderr=subprocess.PIPE, + check=False ) if p.stderr: raise RuntimeError('qrexec call stderr was not empty', diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index ccb1098..34d423c 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -664,7 +664,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtWidgets.QMainWindow): QtCore.QSize(1100, 600))) def get_vms_list(self): - return [vm for vm in self.qubes_app.domains] + return list(self.qubes_app.domains) def fill_table(self): self.table.setSortingEnabled(False) diff --git a/qubesmanager/restore.py b/qubesmanager/restore.py index 48f7531..8f873c5 100644 --- a/qubesmanager/restore.py +++ b/qubesmanager/restore.py @@ -35,7 +35,7 @@ from . import utils from multiprocessing import Queue from queue import Empty -from qubesadmin import Qubes, exc +from qubesadmin import exc from qubesadmin.backup import restore diff --git a/qubesmanager/utils.py b/qubesmanager/utils.py index 5b12256..0a19226 100644 --- a/qubesmanager/utils.py +++ b/qubesmanager/utils.py @@ -30,7 +30,7 @@ import sys import quamash from qubesadmin import events -from PyQt5 import QtWidgets +from PyQt5 import QtWidgets # pylint: disable=import-error from PyQt5.QtGui import QIcon # pylint: disable=import-error @@ -235,7 +235,7 @@ def loop_shutdown(): # Copyright (c) 2002-2007 Pascal Varet def handle_exception(exc_type, exc_value, exc_traceback): - filename, line, dummy, dummy = traceback.extract_tb(exc_traceback).pop() + filename, line, _, _ = traceback.extract_tb(exc_traceback).pop() filename = os.path.basename(filename) error = "%s: %s" % (exc_type.__name__, exc_value)