Changes to for pylint 2.0

Fixes to make pylint 2.0 stop complaining.
This commit is contained in:
Marta Marczykowska-Górecka 2018-07-16 02:00:28 +02:00
parent 3f0af4498c
commit 6f4870bc8d
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
5 changed files with 37 additions and 41 deletions

View File

@ -68,7 +68,7 @@ class SearchBox(QtGui.QLineEdit):
self.focusing = False self.focusing = False
class VmRowInTable(object): class VmRowInTable:
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
def __init__(self, vm, row_no, table): def __init__(self, vm, row_no, table):
self.vm = vm self.vm = vm
@ -667,12 +667,12 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
assert self.vms_in_table[qid] is not None assert self.vms_in_table[qid] is not None
vm = self.vms_in_table[qid].vm vm = self.vms_in_table[qid].vm
return vm return vm
else: return None
return None
# noinspection PyArgumentList # noinspection PyArgumentList
@QtCore.pyqtSlot(name='on_action_removevm_triggered') @QtCore.pyqtSlot(name='on_action_removevm_triggered')
def action_removevm_triggered(self): def action_removevm_triggered(self):
# pylint: disable=no-else-return
vm = self.get_selected_vm() vm = self.get_selected_vm()
@ -703,7 +703,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
# user clicked cancel # user clicked cancel
return return
elif requested_name != vm.name: if requested_name != vm.name:
# name did not match # name did not match
QtGui.QMessageBox.warning( QtGui.QMessageBox.warning(
None, None,
@ -744,7 +744,6 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.tr("ERROR: {0}").format( self.tr("ERROR: {0}").format(
t_monitor.error_msg)) t_monitor.error_msg))
@staticmethod @staticmethod
def do_remove_vm(vm, qubes_app, t_monitor): def do_remove_vm(vm, qubes_app, t_monitor):
try: try:

View File

@ -152,8 +152,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
if event.key() == QtCore.Qt.Key_Enter \ if event.key() == QtCore.Qt.Key_Enter \
or event.key() == QtCore.Qt.Key_Return: or event.key() == QtCore.Qt.Key_Return:
return return
else: super(VMSettingsWindow, self).keyPressEvent(event)
super(VMSettingsWindow, self).keyPressEvent(event)
def reject(self): def reject(self):
self.done(0) self.done(0)
@ -1079,8 +1078,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
self.fw_model.run_rule_dialog(dialog, row) self.fw_model.run_rule_dialog(dialog, row)
def delete_rule_button_pressed(self): def delete_rule_button_pressed(self):
for i in set([index.row() for index for i in {index.row() for index
in self.rulesTreeView.selectedIndexes()]): in self.rulesTreeView.selectedIndexes()}:
self.fw_model.remove_child(i) self.fw_model.remove_child(i)

View File

@ -78,9 +78,9 @@ class VmTypeWidget(VmIconWidget):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.value == other.value: if self.value == other.value:
return self.name < other.name return self.name < other.name
return self.value < other.value return self.value < other.value
@ -126,9 +126,9 @@ class VmLabelWidget(VmIconWidget):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.value == other.value: if self.value == other.value:
return self.name < other.name return self.name < other.name
return self.value < other.value return self.value < other.value
@ -155,7 +155,7 @@ class VmNameItem(QtGui.QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
return super(VmNameItem, self).__lt__(other) return super(VmNameItem, self).__lt__(other)
@ -206,7 +206,7 @@ class VmInfoWidget(QtGui.QWidget):
# pylint: disable=too-many-return-statements # pylint: disable=too-many-return-statements
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
self_val = self.upd_info_item.value self_val = self.upd_info_item.value
@ -220,16 +220,15 @@ class VmInfoWidget(QtGui.QWidget):
if self_val == other_val: if self_val == other_val:
return self.name < other.name return self.name < other.name
return self_val > other_val return self_val > other_val
elif self.tableWidget().\ if self.tableWidget().\
horizontalHeader().sortIndicatorOrder() == power_order: horizontalHeader().sortIndicatorOrder() == power_order:
# the result will be sorted by power state, # the result will be sorted by power state,
# sorting order: Descending # sorting order: Descending
if self.on_icon.status == other.on_icon.status: if self.on_icon.status == other.on_icon.status:
return self.name < other.name return self.name < other.name
return self_val > other_val return self_val > other_val
else: # it would be strange if this happened
# it would be strange if this happened return
return
def __init__(self, vm, parent=None): def __init__(self, vm, parent=None):
super(VmInfoWidget, self).__init__(parent) super(VmInfoWidget, self).__init__(parent)
@ -290,9 +289,9 @@ class VmTemplateItem(QtGui.QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.text() == other.text(): if self.text() == other.text():
return self.name < other.name return self.name < other.name
return super(VmTemplateItem, self).__lt__(other) return super(VmTemplateItem, self).__lt__(other)
@ -316,9 +315,9 @@ class VmNetvmItem(QtGui.QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.text() == other.text(): if self.text() == other.text():
return self.name < other.name return self.name < other.name
return super(VmNetvmItem, self).__lt__(other) return super(VmNetvmItem, self).__lt__(other)
@ -340,9 +339,9 @@ class VmInternalItem(QtGui.QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.internal == other.internal: if self.internal == other.internal:
return self.name < other.name return self.name < other.name
return super(VmInternalItem, self).__lt__(other) return super(VmInternalItem, self).__lt__(other)
@ -369,9 +368,9 @@ class VmUpdateInfoWidget(QtGui.QWidget):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.value == other.value: if self.value == other.value:
return self.name < other.name return self.name < other.name
return self.value < other.value return self.value < other.value
@ -478,9 +477,9 @@ class VmSizeOnDiskItem(QtGui.QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.value == other.value: if self.value == other.value:
return self.name < other.name return self.name < other.name
return self.value < other.value return self.value < other.value
@ -502,9 +501,9 @@ class VmIPItem(QtGui.QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.ip == other.ip: if self.ip == other.ip:
return self.name < other.name return self.name < other.name
return super(VmIPItem, self).__lt__(other) return super(VmIPItem, self).__lt__(other)
@ -530,9 +529,9 @@ class VmIncludeInBackupsItem(QtGui.QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.include_in_backups == other.include_in_backups: if self.include_in_backups == other.include_in_backups:
return self.name < other.name return self.name < other.name
return self.include_in_backups < other.include_in_backups return self.include_in_backups < other.include_in_backups
@ -560,12 +559,12 @@ class VmLastBackupItem(QtGui.QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
if self.qid == 0: if self.qid == 0:
return True return True
elif other.qid == 0: if other.qid == 0:
return False return False
elif self.backup_timestamp == other.backup_timestamp: if self.backup_timestamp == other.backup_timestamp:
return self.name < other.name return self.name < other.name
elif not self.backup_timestamp: if not self.backup_timestamp:
return False return False
elif not other.backup_timestamp: if not other.backup_timestamp:
return True return True
return self.backup_timestamp < other.backup_timestamp return self.backup_timestamp < other.backup_timestamp

View File

@ -169,5 +169,4 @@ def get_path_from_vm(vm, service_name):
assert '../' not in untrusted_path assert '../' not in untrusted_path
assert '\0' not in untrusted_path assert '\0' not in untrusted_path
return untrusted_path.strip() return untrusted_path.strip()
else: raise ValueError('Unexpected characters in path.')
raise ValueError('Unexpected characters in path.')

View File

@ -13,7 +13,7 @@ class BackupRestore(object):
pass pass
def restore_info_verify(self, *args): def restore_info_verify(self, *args):
pass return 'test'
def get_restore_summary(self, *args): def get_restore_summary(self, *args):
pass return 'test'