Second pylint pass

Fixed errors pointed out by pylint on server.
This commit is contained in:
Marta Marczykowska-Górecka 2017-12-11 01:09:29 +01:00
parent a1c6e72569
commit 78b4747e81
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
10 changed files with 50 additions and 18 deletions

View File

@ -31,7 +31,7 @@ from qubes.storage.file import get_disk_usage
from PyQt4 import QtCore # pylint: disable=import-error
from PyQt4 import QtGui # pylint: disable=import-error
from . import ui_backupdlg
from . import ui_backupdlg # pylint: disable=no-name-in-module
from . import multiselectwidget
from . import backup_utils
@ -119,9 +119,9 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
def load_settings(self):
try:
profile_data = backup_utils.load_backup_profile()
except FileNotFoundError as ex: # pylint: disable=unused-variable
except FileNotFoundError:
return
except exc.QubesException as qex: # pylint: disable=unused-variable
except exc.QubesException:
QtGui.QMessageBox.information(
None, self.tr("Error loading backup profile"),
self.tr("Unable to load saved backup profile."))
@ -232,7 +232,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
self.tr("Selected directory do not exists or "
"not a directory (%s).") % backup_location)
return False
if not len(self.passphrase_line_edit.text()):
if not self.passphrase_line_edit.text():
QtGui.QMessageBox.information(
None, self.tr("Wait!"),
self.tr("Enter passphrase for backup "
@ -268,7 +268,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
except Exception as ex: # pylint: disable=broad-except
msg.append(str(ex))
if len(msg) > 0:
if msg:
t_monitor.set_error_msg('\n'.join(msg))
t_monitor.set_finished()
@ -358,7 +358,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
return self.select_vms_widget.selected_list.count() > 0
def has_selected_dir_and_pass(self):
if not len(self.passphrase_line_edit.text()):
if not self.passphrase_line_edit.text():
return False
if self.passphrase_line_edit.text() != \
self.passphrase_line_edit_verify.text():

View File

@ -19,8 +19,8 @@
#
#
import re
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4 import QtGui # pylint: disable=import-error
from PyQt4 import QtCore # pylint: disable=import-error
import subprocess
from . import utils
@ -65,8 +65,7 @@ def select_path_button_clicked(dialog, select_file=False):
vm,
"qubes.SelectFile" if select_file
else "qubes.SelectDirectory")
except subprocess.CalledProcessError as ex:
# pylint: disable=unused-variable
except subprocess.CalledProcessError:
QtGui.QMessageBox.warning(
None,
dialog.tr("Nothing selected!"),
@ -75,7 +74,7 @@ def select_path_button_clicked(dialog, select_file=False):
if new_path:
dialog.dir_line_edit.setText(new_path)
if new_path and len(backup_location) > 0:
if new_path and backup_location:
dialog.select_dir_page.emit(QtCore.SIGNAL("completeChanged()"))

View File

@ -22,8 +22,8 @@
import sys
import shutil
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4 import QtCore # pylint: disable=import-error
from PyQt4 import QtGui # pylint: disable=import-error
import threading
import time
import os
@ -34,7 +34,7 @@ import signal
from qubes import backup
from . import ui_restoredlg
from . import ui_restoredlg # pylint: disable=no-name-in-module
from . import multiselectwidget
from . import backup_utils
from . import thread_monitor
@ -180,8 +180,8 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard):
self.emit(QtCore.SIGNAL("restore_progress(QString)"),
'<b><font color="red">{0}</font></b>'
.format(self.tr("Restore aborted!")))
elif len(err_msg) > 0 or self.error_detected.is_set():
if len(err_msg) > 0:
elif err_msg or self.error_detected.is_set():
if err_msg:
t_monitor.set_error_msg('\n'.join(err_msg))
self.emit(QtCore.SIGNAL("restore_progress(QString)"),
'<b><font color="red">{0}</font></b>'

View File

@ -0,0 +1,5 @@
class BackupCanceledError(BaseException):
tmpdir = None
pass

View File

@ -1,2 +1,2 @@
def get_disk_usage(*args):
return None
return 0

View File

@ -0,0 +1 @@
pass

View File

@ -0,0 +1,19 @@
class BackupRestore(object):
options = object()
canceled = None
def get_restore_info(self, *args):
pass
def restore_do(self, *args):
pass
def get_restore_info(self, *args):
pass
def restore_info_verify(self, *args):
pass
def get_restore_summary(self, *args):
pass

View File

@ -0,0 +1,5 @@
class EventsDispatcher(object):
def add_handler(self, *args):
pass
pass

View File

@ -1,4 +1,4 @@
### mock qubesadmin.exc module
# pylint: disable=unused-variable### mock qubesadmin.exc module
class QubesException(BaseException):
pass

View File

@ -5,3 +5,6 @@ def parse_size(*args, **kwargs):
def updates_vms_status(*args, **kwargs):
return args[0]
def size_to_human(*args, **kwargs):
return args[0]