Update linting due to new Ruff rules
This commit is contained in:
+2
-2
@@ -7,8 +7,8 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import PyQt6.QtCore
|
import PyQt6.QtCore # noqa: F401
|
||||||
import PyQt6.QtGui
|
import PyQt6.QtGui # noqa: F401
|
||||||
import PyQt6.QtWidgets # noqa: F401
|
import PyQt6.QtWidgets # noqa: F401
|
||||||
except Exception:
|
except Exception:
|
||||||
print("ERROR: Failed to load dependency PyQt6")
|
print("ERROR: Failed to load dependency PyQt6")
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ class NWStatus:
|
|||||||
icon = NWStatus.createIcon(self._height, color, shape)
|
icon = NWStatus.createIcon(self._height, color, shape)
|
||||||
return StatusEntry(simplified(data[2]), color, theme, shape, icon)
|
return StatusEntry(simplified(data[2]), color, theme, shape, icon)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.error("Could not parse entry %s", str(data))
|
logger.error("Could not parse entry %s", data)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def refreshIcons(self) -> None:
|
def refreshIcons(self) -> None:
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class NWTree:
|
|||||||
"""
|
"""
|
||||||
if tHandle and tHandle in self._items:
|
if tHandle and tHandle in self._items:
|
||||||
return self._items[tHandle]
|
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
|
return None
|
||||||
|
|
||||||
def __contains__(self, tHandle: str) -> bool:
|
def __contains__(self, tHandle: str) -> bool:
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ def exceptionHandler(exType: type, exValue: BaseException, exTrace: TracebackTyp
|
|||||||
|
|
||||||
from PyQt6.QtWidgets import QApplication
|
from PyQt6.QtWidgets import QApplication
|
||||||
|
|
||||||
logger.critical("%s: %s", exType.__name__, str(exValue))
|
logger.critical("%s: %s", exType.__name__, exValue)
|
||||||
print_tb(exTrace)
|
print_tb(exTrace)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -672,7 +672,7 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
self.spellCheckStateChanged.emit(state)
|
self.spellCheckStateChanged.emit(state)
|
||||||
self.spellCheckDocument()
|
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:
|
def spellCheckDocument(self) -> None:
|
||||||
"""Rerun the highlighter to update spell checking status of the
|
"""Rerun the highlighter to update spell checking status of the
|
||||||
@@ -785,7 +785,7 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
elif action == nwDocAction.SC_SUB:
|
elif action == nwDocAction.SC_SUB:
|
||||||
self._wrapSelection(nwShortcode.SUB_O, nwShortcode.SUB_C)
|
self._wrapSelection(nwShortcode.SUB_O, nwShortcode.SUB_C)
|
||||||
else:
|
else:
|
||||||
logger.debug("Unknown or unsupported document action '%s'", str(action))
|
logger.debug("Unknown or unsupported document action '%s'", action)
|
||||||
self._allowAutoReplace(True)
|
self._allowAutoReplace(True)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -1750,7 +1750,7 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
elif action == nwDocAction.BLOCK_TXT:
|
elif action == nwDocAction.BLOCK_TXT:
|
||||||
text = temp
|
text = temp
|
||||||
else:
|
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 nwDocAction.NO_ACTION, "", 0
|
||||||
|
|
||||||
return action, text, offset
|
return action, text, offset
|
||||||
@@ -1760,7 +1760,7 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
cursor = self.textCursor()
|
cursor = self.textCursor()
|
||||||
block = cursor.block()
|
block = cursor.block()
|
||||||
if not block.isValid():
|
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
|
return False
|
||||||
|
|
||||||
action, text, offset = self._processBlockFormat(action, block.text())
|
action, text, offset = self._processBlockFormat(action, block.text())
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
elif action == nwDocAction.SEL_PARA:
|
elif action == nwDocAction.SEL_PARA:
|
||||||
self._makeSelection(QTextCursor.SelectionType.BlockUnderCursor)
|
self._makeSelection(QTextCursor.SelectionType.BlockUnderCursor)
|
||||||
else:
|
else:
|
||||||
logger.debug("Unknown or unsupported document action '%s'", str(action))
|
logger.debug("Unknown or unsupported document action '%s'", action)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ class GuiOutlineTree(QTreeWidget):
|
|||||||
try:
|
try:
|
||||||
for name, (hidden, width) in colState.items():
|
for name, (hidden, width) in colState.items():
|
||||||
if name not in nwOutline.__members__:
|
if name not in nwOutline.__members__:
|
||||||
logger.warning("Ignored unknown outline column '%s'", str(name))
|
logger.warning("Ignored unknown outline column '%s'", name)
|
||||||
continue
|
continue
|
||||||
tmpOrder.append(nwOutline[name])
|
tmpOrder.append(nwOutline[name])
|
||||||
tmpHidden[nwOutline[name]] = hidden
|
tmpHidden[nwOutline[name]] = hidden
|
||||||
|
|||||||
Reference in New Issue
Block a user