Skip to content

Commit

Permalink
make pylint happy
Browse files Browse the repository at this point in the history
- no-self-use was moved to an extension, drop usage
- bad-functions was moved to an extension, drop option (was empty
  anyway)
- silent warnings in update_model_data()
- adjust for unnecessary-lambda-assignment
  • Loading branch information
marmarek committed Jul 10, 2022
1 parent 5f85661 commit 698e14a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
3 changes: 0 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ generated-members=

[BASIC]

# List of builtins function names that should not be used, separated by a comma
bad-functions=

# Regular expression which should only match correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

Expand Down
4 changes: 2 additions & 2 deletions qubesmanager/firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def index(self, row, column, parent=QtCore.QModelIndex()):

return self.createIndex(row, column, self.children[row])

def parent(self, child): # pylint: disable=unused-argument,no-self-use
def parent(self, child): # pylint: disable=unused-argument
return QtCore.QModelIndex()

# pylint: disable=invalid-name,unused-argument
Expand All @@ -408,7 +408,7 @@ def rowCount(self, parent=QtCore.QModelIndex()):
def columnCount(self, parent=QtCore.QModelIndex()):
return len(self.__column_names)

# pylint: disable=invalid-name,no-self-use
# pylint: disable=invalid-name
def hasChildren(self, index=QtCore.QModelIndex()):
parent_item = index.internalPointer()
return parent_item is None
Expand Down
9 changes: 6 additions & 3 deletions qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,10 @@ def get_vm(self, row=None, qid=None, name=None):
return next(x for x in self._info_list if x.name == name)

def update_model_data(self, *args, **kwargs):
# pylint: disable=unused-argument
for vm_info in self._info_list:
# FIXME: add helper maybe?
# pylint: disable=protected-access
vm_info.vm._power_state_cache = None
vm_info.update()

Expand Down Expand Up @@ -779,7 +782,8 @@ def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):

# Connect events
self.dispatcher = dispatcher
dispatcher.add_handler('connection-established', self.qubes_cache.update_model_data)
dispatcher.add_handler('connection-established',
self.qubes_cache.update_model_data)
dispatcher.add_handler('domain-pre-start',
self.on_domain_status_changed)
dispatcher.add_handler('domain-start', self.on_domain_status_changed)
Expand Down Expand Up @@ -1627,7 +1631,6 @@ def action_global_settings_triggered(self): # pylint: disable=invalid-name
# noinspection PyArgumentList
@pyqtSlot(name='on_action_manage_templates_triggered')
def action_manage_templates_triggered(self):
# pylint: disable=no-self-use
subprocess.check_call('qubes-template-manager')

# noinspection PyArgumentList
Expand Down Expand Up @@ -1692,7 +1695,7 @@ def showhide_column(self, col_num, show):

# noinspection PyArgumentList
@pyqtSlot(name='on_action_about_qubes_triggered')
def action_about_qubes_triggered(self): # pylint: disable=no-self-use
def action_about_qubes_triggered(self):
about = AboutDialog(self)
about.exec_()

Expand Down
8 changes: 0 additions & 8 deletions qubesmanager/qvm_template_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,15 @@ def createEditor(self, parent, option, index):
return None

def setEditorData(self, editor, index):
#pylint: disable=no-self-use
cur = index.data()
idx = editor.findText(cur)
if idx >= 0:
editor.setCurrentIndex(idx)

def setModelData(self, editor, model, index):
#pylint: disable=no-self-use
model.setData(index, editor.currentText())

def updateEditorGeometry(self, editor, option, index):
#pylint: disable=no-self-use
_ = index # unused
editor.setGeometry(option.rect)

Expand Down Expand Up @@ -149,22 +146,18 @@ def index(self, row, column, parent=PyQt5.QtCore.QModelIndex()):
return self.createIndex(row, column, self.children[row])

def parent(self, child):
#pylint: disable=no-self-use
_ = child # unused
return PyQt5.QtCore.QModelIndex()

def rowCount(self, parent=PyQt5.QtCore.QModelIndex()):
#pylint: disable=no-self-use
_ = parent # unused
return len(self.children)

def columnCount(self, parent=PyQt5.QtCore.QModelIndex()):
#pylint: disable=no-self-use
_ = parent # unused
return len(Template.COL_NAMES)

def hasChildren(self, index=PyQt5.QtCore.QModelIndex()):
#pylint: disable=no-self-use
return index == PyQt5.QtCore.QModelIndex()

def data(self, index, role=PyQt5.QtCore.Qt.DisplayRole):
Expand Down Expand Up @@ -200,7 +193,6 @@ def setData(self, index, value, role=PyQt5.QtCore.Qt.EditRole):

def headerData(self, section, orientation,
role=PyQt5.QtCore.Qt.DisplayRole):
#pylint: disable=no-self-use
if section < len(Template.COL_NAMES) \
and orientation == PyQt5.QtCore.Qt.Horizontal \
and role == PyQt5.QtCore.Qt.DisplayRole:
Expand Down
6 changes: 3 additions & 3 deletions qubesmanager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def translate(string):

class SizeSpinBox(QtWidgets.QSpinBox):
"""A SpinBox subclass with extended handling for sizes in MB and GB"""
# pylint: disable=invalid-name, no-self-use
# pylint: disable=invalid-name
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down Expand Up @@ -363,8 +363,8 @@ def initialize_widget_with_labels(widget, qubes_app,
labels = sorted(qubes_app.labels.values(), key=lambda l: l.index)
choices = [(label.name, label) for label in labels]

icon_getter = (lambda label:
QtGui.QIcon.fromTheme(label.icon))
def icon_getter(label):
return QtGui.QIcon.fromTheme(label.icon)

if holder:
initialize_widget_for_property(widget=widget,
Expand Down

0 comments on commit 698e14a

Please sign in to comment.