diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 7d8931c..d4fab94 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -68,7 +68,7 @@ class SearchBox(QtGui.QLineEdit): self.focusing = False -class VmRowInTable(object): +class VmRowInTable: # pylint: disable=too-few-public-methods def __init__(self, vm, row_no, table): self.vm = vm @@ -667,12 +667,12 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): assert self.vms_in_table[qid] is not None vm = self.vms_in_table[qid].vm return vm - else: - return None + return None # noinspection PyArgumentList @QtCore.pyqtSlot(name='on_action_removevm_triggered') def action_removevm_triggered(self): + # pylint: disable=no-else-return vm = self.get_selected_vm() @@ -703,7 +703,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): # user clicked cancel return - elif requested_name != vm.name: + if requested_name != vm.name: # name did not match QtGui.QMessageBox.warning( None, @@ -744,7 +744,6 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): self.tr("ERROR: {0}").format( t_monitor.error_msg)) - @staticmethod def do_remove_vm(vm, qubes_app, t_monitor): try: diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 9de9baa..db10e0a 100755 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -152,8 +152,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): if event.key() == QtCore.Qt.Key_Enter \ or event.key() == QtCore.Qt.Key_Return: return - else: - super(VMSettingsWindow, self).keyPressEvent(event) + super(VMSettingsWindow, self).keyPressEvent(event) def reject(self): self.done(0) @@ -1079,8 +1078,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): self.fw_model.run_rule_dialog(dialog, row) def delete_rule_button_pressed(self): - for i in set([index.row() for index - in self.rulesTreeView.selectedIndexes()]): + for i in {index.row() for index + in self.rulesTreeView.selectedIndexes()}: self.fw_model.remove_child(i) diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index 4dd5538..8c440f3 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -78,9 +78,9 @@ class VmTypeWidget(VmIconWidget): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False - elif self.value == other.value: + if self.value == other.value: return self.name < other.name return self.value < other.value @@ -126,9 +126,9 @@ class VmLabelWidget(VmIconWidget): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False - elif self.value == other.value: + if self.value == other.value: return self.name < other.name return self.value < other.value @@ -155,7 +155,7 @@ class VmNameItem(QtGui.QTableWidgetItem): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False return super(VmNameItem, self).__lt__(other) @@ -206,7 +206,7 @@ class VmInfoWidget(QtGui.QWidget): # pylint: disable=too-many-return-statements if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False self_val = self.upd_info_item.value @@ -220,16 +220,15 @@ class VmInfoWidget(QtGui.QWidget): if self_val == other_val: return self.name < other.name return self_val > other_val - elif self.tableWidget().\ + if self.tableWidget().\ horizontalHeader().sortIndicatorOrder() == power_order: # the result will be sorted by power state, # sorting order: Descending if self.on_icon.status == other.on_icon.status: return self.name < other.name return self_val > other_val - else: - # it would be strange if this happened - return + # it would be strange if this happened + return def __init__(self, vm, parent=None): super(VmInfoWidget, self).__init__(parent) @@ -290,9 +289,9 @@ class VmTemplateItem(QtGui.QTableWidgetItem): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False - elif self.text() == other.text(): + if self.text() == other.text(): return self.name < other.name return super(VmTemplateItem, self).__lt__(other) @@ -316,9 +315,9 @@ class VmNetvmItem(QtGui.QTableWidgetItem): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False - elif self.text() == other.text(): + if self.text() == other.text(): return self.name < other.name return super(VmNetvmItem, self).__lt__(other) @@ -340,9 +339,9 @@ class VmInternalItem(QtGui.QTableWidgetItem): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False - elif self.internal == other.internal: + if self.internal == other.internal: return self.name < other.name return super(VmInternalItem, self).__lt__(other) @@ -369,9 +368,9 @@ class VmUpdateInfoWidget(QtGui.QWidget): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False - elif self.value == other.value: + if self.value == other.value: return self.name < other.name return self.value < other.value @@ -478,9 +477,9 @@ class VmSizeOnDiskItem(QtGui.QTableWidgetItem): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False - elif self.value == other.value: + if self.value == other.value: return self.name < other.name return self.value < other.value @@ -502,9 +501,9 @@ class VmIPItem(QtGui.QTableWidgetItem): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False - elif self.ip == other.ip: + if self.ip == other.ip: return self.name < other.name return super(VmIPItem, self).__lt__(other) @@ -530,9 +529,9 @@ class VmIncludeInBackupsItem(QtGui.QTableWidgetItem): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: 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.include_in_backups < other.include_in_backups @@ -560,12 +559,12 @@ class VmLastBackupItem(QtGui.QTableWidgetItem): def __lt__(self, other): if self.qid == 0: return True - elif other.qid == 0: + if other.qid == 0: return False - elif self.backup_timestamp == other.backup_timestamp: + if self.backup_timestamp == other.backup_timestamp: return self.name < other.name - elif not self.backup_timestamp: + if not self.backup_timestamp: return False - elif not other.backup_timestamp: + if not other.backup_timestamp: return True return self.backup_timestamp < other.backup_timestamp diff --git a/qubesmanager/utils.py b/qubesmanager/utils.py index 5b40f5f..dc7950f 100644 --- a/qubesmanager/utils.py +++ b/qubesmanager/utils.py @@ -169,5 +169,4 @@ def get_path_from_vm(vm, service_name): assert '../' not in untrusted_path assert '\0' not in untrusted_path return untrusted_path.strip() - else: - raise ValueError('Unexpected characters in path.') + raise ValueError('Unexpected characters in path.') diff --git a/test-packages/qubesadmin/backup/restore/__init__.py b/test-packages/qubesadmin/backup/restore/__init__.py index aa328db..a6b46c6 100644 --- a/test-packages/qubesadmin/backup/restore/__init__.py +++ b/test-packages/qubesadmin/backup/restore/__init__.py @@ -13,7 +13,7 @@ class BackupRestore(object): pass def restore_info_verify(self, *args): - pass + return 'test' def get_restore_summary(self, *args): - pass + return 'test'