Skip to content

Commit

Permalink
Changes to for pylint 2.0
Browse files Browse the repository at this point in the history
Fixes to make pylint 2.0 stop complaining.
  • Loading branch information
marmarta committed Jul 16, 2018
1 parent 3f0af44 commit 6f4870b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 41 deletions.
9 changes: 4 additions & 5 deletions qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def mousePressEvent(self, e): # pylint: disable=invalid-name
self.focusing = False


class VmRowInTable(object):
class VmRowInTable:
# pylint: disable=too-few-public-methods
def __init__(self, vm, row_no, table):
self.vm = vm
Expand Down Expand Up @@ -667,12 +667,12 @@ def get_selected_vm(self):
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()

Expand Down Expand Up @@ -703,7 +703,7 @@ def action_removevm_triggered(self):
# user clicked cancel
return

elif requested_name != vm.name:
if requested_name != vm.name:
# name did not match
QtGui.QMessageBox.warning(
None,
Expand Down Expand Up @@ -744,7 +744,6 @@ def action_removevm_triggered(self):
self.tr("ERROR: {0}").format(
t_monitor.error_msg))


@staticmethod
def do_remove_vm(vm, qubes_app, t_monitor):
try:
Expand Down
7 changes: 3 additions & 4 deletions qubesmanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ def keyPressEvent(self, event): # pylint: disable=invalid-name
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)
Expand Down Expand Up @@ -1079,8 +1078,8 @@ def edit_rule_button_pressed(self):
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)


Expand Down
55 changes: 27 additions & 28 deletions qubesmanager/table_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def set_value(self, value):
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

Expand Down Expand Up @@ -126,9 +126,9 @@ def set_value(self, value):
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

Expand All @@ -155,7 +155,7 @@ def __init__(self, vm):
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)

Expand Down Expand Up @@ -206,7 +206,7 @@ def __lt__(self, other):
# 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
Expand All @@ -220,16 +220,15 @@ def __lt__(self, other):
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)
Expand Down Expand Up @@ -290,9 +289,9 @@ def update(self):
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)

Expand All @@ -316,9 +315,9 @@ def update(self):
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)

Expand All @@ -340,9 +339,9 @@ def update(self):
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)

Expand All @@ -369,9 +368,9 @@ def set_value(self, value):
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

Expand Down Expand Up @@ -478,9 +477,9 @@ def update(self):
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

Expand All @@ -502,9 +501,9 @@ def update(self):
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)

Expand All @@ -530,9 +529,9 @@ def update(self):
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

Expand Down Expand Up @@ -560,12 +559,12 @@ def update(self):
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
3 changes: 1 addition & 2 deletions qubesmanager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
4 changes: 2 additions & 2 deletions test-packages/qubesadmin/backup/restore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_restore_info(self, *args):
pass

def restore_info_verify(self, *args):
pass
return 'test'

def get_restore_summary(self, *args):
pass
return 'test'

0 comments on commit 6f4870b

Please sign in to comment.