Use Ruff for linting and fix a ton of issues

This commit is contained in:
Veronica Berglyd Olsen
2025-04-03 01:15:52 +02:00
parent d2796d27c3
commit 53a2d0e691
43 changed files with 257 additions and 235 deletions
+4 -4
View File
@@ -355,7 +355,7 @@ class Config:
"""Set the last used path. Only the folder is saved, so if the
path is not a folder, the parent of the path is used instead.
"""
if isinstance(path, (str, Path)):
if isinstance(path, str | Path):
path = checkPath(path, self._homePath)
if not path.is_dir():
path = path.parent
@@ -504,10 +504,10 @@ class Config:
and dataPath is mainly intended for the test suite.
"""
logger.debug("Initialising Config ...")
if isinstance(confPath, (str, Path)):
if isinstance(confPath, str | Path):
logger.info("Setting alternative config path: %s", confPath)
self._confPath = Path(confPath)
if isinstance(dataPath, (str, Path)):
if isinstance(dataPath, str | Path):
logger.info("Setting alternative data path: %s", dataPath)
self._dataPath = Path(dataPath)
@@ -555,7 +555,7 @@ class Config:
for lngPath, lngBase in langList:
for lngCode in self._qLocale.uiLanguages():
qTrans = QTranslator()
lngFile = "%s_%s" % (lngBase, lngCode.replace("-", "_"))
lngFile = "{0}_{1}".format(lngBase, lngCode.replace("-", "_"))
if lngFile not in self._qtTrans:
if qTrans.load(lngFile, lngPath):
logger.debug("Loaded: %s.qm", lngFile)