Second pylint pass
Fixed errors pointed out by pylint on server.
This commit is contained in:
parent
a1c6e72569
commit
78b4747e81
@ -31,7 +31,7 @@ from qubes.storage.file import get_disk_usage
|
|||||||
|
|
||||||
from PyQt4 import QtCore # pylint: disable=import-error
|
from PyQt4 import QtCore # pylint: disable=import-error
|
||||||
from PyQt4 import QtGui # 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 multiselectwidget
|
||||||
|
|
||||||
from . import backup_utils
|
from . import backup_utils
|
||||||
@ -119,9 +119,9 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
|||||||
def load_settings(self):
|
def load_settings(self):
|
||||||
try:
|
try:
|
||||||
profile_data = backup_utils.load_backup_profile()
|
profile_data = backup_utils.load_backup_profile()
|
||||||
except FileNotFoundError as ex: # pylint: disable=unused-variable
|
except FileNotFoundError:
|
||||||
return
|
return
|
||||||
except exc.QubesException as qex: # pylint: disable=unused-variable
|
except exc.QubesException:
|
||||||
QtGui.QMessageBox.information(
|
QtGui.QMessageBox.information(
|
||||||
None, self.tr("Error loading backup profile"),
|
None, self.tr("Error loading backup profile"),
|
||||||
self.tr("Unable to load saved 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 "
|
self.tr("Selected directory do not exists or "
|
||||||
"not a directory (%s).") % backup_location)
|
"not a directory (%s).") % backup_location)
|
||||||
return False
|
return False
|
||||||
if not len(self.passphrase_line_edit.text()):
|
if not self.passphrase_line_edit.text():
|
||||||
QtGui.QMessageBox.information(
|
QtGui.QMessageBox.information(
|
||||||
None, self.tr("Wait!"),
|
None, self.tr("Wait!"),
|
||||||
self.tr("Enter passphrase for backup "
|
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
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
msg.append(str(ex))
|
msg.append(str(ex))
|
||||||
|
|
||||||
if len(msg) > 0:
|
if msg:
|
||||||
t_monitor.set_error_msg('\n'.join(msg))
|
t_monitor.set_error_msg('\n'.join(msg))
|
||||||
|
|
||||||
t_monitor.set_finished()
|
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
|
return self.select_vms_widget.selected_list.count() > 0
|
||||||
|
|
||||||
def has_selected_dir_and_pass(self):
|
def has_selected_dir_and_pass(self):
|
||||||
if not len(self.passphrase_line_edit.text()):
|
if not self.passphrase_line_edit.text():
|
||||||
return False
|
return False
|
||||||
if self.passphrase_line_edit.text() != \
|
if self.passphrase_line_edit.text() != \
|
||||||
self.passphrase_line_edit_verify.text():
|
self.passphrase_line_edit_verify.text():
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
import re
|
import re
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui # pylint: disable=import-error
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore # pylint: disable=import-error
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from . import utils
|
from . import utils
|
||||||
@ -65,8 +65,7 @@ def select_path_button_clicked(dialog, select_file=False):
|
|||||||
vm,
|
vm,
|
||||||
"qubes.SelectFile" if select_file
|
"qubes.SelectFile" if select_file
|
||||||
else "qubes.SelectDirectory")
|
else "qubes.SelectDirectory")
|
||||||
except subprocess.CalledProcessError as ex:
|
except subprocess.CalledProcessError:
|
||||||
# pylint: disable=unused-variable
|
|
||||||
QtGui.QMessageBox.warning(
|
QtGui.QMessageBox.warning(
|
||||||
None,
|
None,
|
||||||
dialog.tr("Nothing selected!"),
|
dialog.tr("Nothing selected!"),
|
||||||
@ -75,7 +74,7 @@ def select_path_button_clicked(dialog, select_file=False):
|
|||||||
if new_path:
|
if new_path:
|
||||||
dialog.dir_line_edit.setText(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()"))
|
dialog.select_dir_page.emit(QtCore.SIGNAL("completeChanged()"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore # pylint: disable=import-error
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui # pylint: disable=import-error
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
@ -34,7 +34,7 @@ import signal
|
|||||||
|
|
||||||
from qubes import backup
|
from qubes import backup
|
||||||
|
|
||||||
from . import ui_restoredlg
|
from . import ui_restoredlg # pylint: disable=no-name-in-module
|
||||||
from . import multiselectwidget
|
from . import multiselectwidget
|
||||||
from . import backup_utils
|
from . import backup_utils
|
||||||
from . import thread_monitor
|
from . import thread_monitor
|
||||||
@ -180,8 +180,8 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard):
|
|||||||
self.emit(QtCore.SIGNAL("restore_progress(QString)"),
|
self.emit(QtCore.SIGNAL("restore_progress(QString)"),
|
||||||
'<b><font color="red">{0}</font></b>'
|
'<b><font color="red">{0}</font></b>'
|
||||||
.format(self.tr("Restore aborted!")))
|
.format(self.tr("Restore aborted!")))
|
||||||
elif len(err_msg) > 0 or self.error_detected.is_set():
|
elif err_msg or self.error_detected.is_set():
|
||||||
if len(err_msg) > 0:
|
if err_msg:
|
||||||
t_monitor.set_error_msg('\n'.join(err_msg))
|
t_monitor.set_error_msg('\n'.join(err_msg))
|
||||||
self.emit(QtCore.SIGNAL("restore_progress(QString)"),
|
self.emit(QtCore.SIGNAL("restore_progress(QString)"),
|
||||||
'<b><font color="red">{0}</font></b>'
|
'<b><font color="red">{0}</font></b>'
|
||||||
|
5
test-packages/qubes/backup/__init__.py
Normal file
5
test-packages/qubes/backup/__init__.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class BackupCanceledError(BaseException):
|
||||||
|
|
||||||
|
tmpdir = None
|
||||||
|
|
||||||
|
pass
|
@ -1,2 +1,2 @@
|
|||||||
def get_disk_usage(*args):
|
def get_disk_usage(*args):
|
||||||
return None
|
return 0
|
||||||
|
1
test-packages/qubesadmin/backup/__init__.py
Normal file
1
test-packages/qubesadmin/backup/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
pass
|
19
test-packages/qubesadmin/backup/restore/__init__.py
Normal file
19
test-packages/qubesadmin/backup/restore/__init__.py
Normal 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
|
5
test-packages/qubesadmin/events.py
Normal file
5
test-packages/qubesadmin/events.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class EventsDispatcher(object):
|
||||||
|
|
||||||
|
def add_handler(self, *args):
|
||||||
|
pass
|
||||||
|
pass
|
@ -1,4 +1,4 @@
|
|||||||
### mock qubesadmin.exc module
|
# pylint: disable=unused-variable### mock qubesadmin.exc module
|
||||||
|
|
||||||
class QubesException(BaseException):
|
class QubesException(BaseException):
|
||||||
pass
|
pass
|
||||||
|
@ -5,3 +5,6 @@ def parse_size(*args, **kwargs):
|
|||||||
|
|
||||||
def updates_vms_status(*args, **kwargs):
|
def updates_vms_status(*args, **kwargs):
|
||||||
return args[0]
|
return args[0]
|
||||||
|
|
||||||
|
def size_to_human(*args, **kwargs):
|
||||||
|
return args[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user