diff -r 45d226917534 -r 50eba81e4a9f PluginPyLint.py --- a/PluginPyLint.py Wed Dec 30 11:02:01 2020 +0100 +++ b/PluginPyLint.py Sat Apr 24 17:01:22 2021 +0200 @@ -11,6 +11,7 @@ import os import copy import platform +import contextlib from PyQt5.QtCore import QObject, QTranslator, QCoreApplication, QProcess from PyQt5.QtWidgets import QDialog @@ -29,7 +30,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "7.1.2" +version = "7.1.3" className = "PyLintPlugin" packageName = "PyLint" shortDescription = "Show the PyLint dialogs." @@ -124,7 +125,7 @@ def getExePath(branch, access, versionStr): exes = [] - try: + with contextlib.suppress(WindowsError, OSError): software = winreg.OpenKey(branch, 'Software', 0, access) python = winreg.OpenKey(software, 'Python', 0, access) pcore = winreg.OpenKey(python, 'PythonCore', 0, access) @@ -138,8 +139,6 @@ exe = os.path.join(installpath, 'Scripts', 'pylint.exe') if os.access(exe, os.X_OK): exes.append(exe) - except (WindowsError, OSError): # __IGNORE_WARNING__ - pass return exes versionSuffixes = ["", "-32", "-64"] @@ -613,10 +612,8 @@ @param editor reference to the editor (QScintilla.Editor) """ - try: + with contextlib.suppress(ValueError): self.__editors.remove(editor) - except ValueError: - pass def __editorShowMenu(self, menuName, menu, editor): """ @@ -637,9 +634,11 @@ Private slot to handle the Pylint context menu action of the editors. """ editor = e5App().getObject("ViewManager").activeWindow() - if editor is not None: - if not editor.checkDirty(): - return + if ( + editor is not None and + not editor.checkDirty() + ): + return fn = editor.getFileName() project = e5App().getObject("Project")