Update linting due to new Ruff rules

This commit is contained in:
Veronica Berglyd Olsen
2025-10-04 18:36:44 +02:00
parent 98cdd4eedf
commit 100aad1256
7 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ import os
import sys
try:
import PyQt6.QtCore
import PyQt6.QtGui
import PyQt6.QtCore # noqa: F401
import PyQt6.QtGui # noqa: F401
import PyQt6.QtWidgets # noqa: F401
except Exception:
print("ERROR: Failed to load dependency PyQt6")
+1 -1
View File
@@ -183,7 +183,7 @@ class NWStatus:
icon = NWStatus.createIcon(self._height, color, shape)
return StatusEntry(simplified(data[2]), color, theme, shape, icon)
except Exception:
logger.error("Could not parse entry %s", str(data))
logger.error("Could not parse entry %s", data)
return None
def refreshIcons(self) -> None:
+1 -1
View File
@@ -89,7 +89,7 @@ class NWTree:
"""
if tHandle and tHandle in self._items:
return self._items[tHandle]
logger.error("No tree item with handle '%s'", str(tHandle))
logger.error("No tree item with handle '%s'", tHandle)
return None
def __contains__(self, tHandle: str) -> bool:
+1 -1
View File
@@ -171,7 +171,7 @@ def exceptionHandler(exType: type, exValue: BaseException, exTrace: TracebackTyp
from PyQt6.QtWidgets import QApplication
logger.critical("%s: %s", exType.__name__, str(exValue))
logger.critical("%s: %s", exType.__name__, exValue)
print_tb(exTrace)
try:
+4 -4
View File
@@ -672,7 +672,7 @@ class GuiDocEditor(QPlainTextEdit):
self.spellCheckStateChanged.emit(state)
self.spellCheckDocument()
logger.debug("Spell check is set to '%s'", str(state))
logger.debug("Spell check is set to '%s'", state)
def spellCheckDocument(self) -> None:
"""Rerun the highlighter to update spell checking status of the
@@ -785,7 +785,7 @@ class GuiDocEditor(QPlainTextEdit):
elif action == nwDocAction.SC_SUB:
self._wrapSelection(nwShortcode.SUB_O, nwShortcode.SUB_C)
else:
logger.debug("Unknown or unsupported document action '%s'", str(action))
logger.debug("Unknown or unsupported document action '%s'", action)
self._allowAutoReplace(True)
return False
@@ -1750,7 +1750,7 @@ class GuiDocEditor(QPlainTextEdit):
elif action == nwDocAction.BLOCK_TXT:
text = temp
else:
logger.error("Unknown or unsupported block format requested: '%s'", str(action))
logger.error("Unknown or unsupported block format requested: '%s'", action)
return nwDocAction.NO_ACTION, "", 0
return action, text, offset
@@ -1760,7 +1760,7 @@ class GuiDocEditor(QPlainTextEdit):
cursor = self.textCursor()
block = cursor.block()
if not block.isValid():
logger.debug("Invalid block selected for action '%s'", str(action))
logger.debug("Invalid block selected for action '%s'", action)
return False
action, text, offset = self._processBlockFormat(action, block.text())
+1 -1
View File
@@ -291,7 +291,7 @@ class GuiDocViewer(QTextBrowser):
elif action == nwDocAction.SEL_PARA:
self._makeSelection(QTextCursor.SelectionType.BlockUnderCursor)
else:
logger.debug("Unknown or unsupported document action '%s'", str(action))
logger.debug("Unknown or unsupported document action '%s'", action)
return False
return True
+1 -1
View File
@@ -586,7 +586,7 @@ class GuiOutlineTree(QTreeWidget):
try:
for name, (hidden, width) in colState.items():
if name not in nwOutline.__members__:
logger.warning("Ignored unknown outline column '%s'", str(name))
logger.warning("Ignored unknown outline column '%s'", name)
continue
tmpOrder.append(nwOutline[name])
tmpHidden[nwOutline[name]] = hidden