- implemented some code simplifications release-7.1.3

Sat, 24 Apr 2021 17:01:22 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 24 Apr 2021 17:01:22 +0200
changeset 95
50eba81e4a9f
parent 94
45d226917534
child 96
21b6b988b938

- implemented some code simplifications

ChangeLog file | annotate | diff | comparison | revisions
PluginPyLint.epj file | annotate | diff | comparison | revisions
PluginPyLint.py file | annotate | diff | comparison | revisions
PluginPyLint.zip file | annotate | diff | comparison | revisions
PyLint/Documentation/source/Plugin_Checker_PyLint.PluginPyLint.html file | annotate | diff | comparison | revisions
PyLint/Documentation/source/Plugin_Checker_PyLint.PyLint.PyLintConfigDialog.html file | annotate | diff | comparison | revisions
PyLint/Documentation/source/Plugin_Checker_PyLint.PyLint.PyLintExecDialog.html file | annotate | diff | comparison | revisions
PyLint/PyLintConfigDialog.py file | annotate | diff | comparison | revisions
PyLint/PyLintExecDialog.py file | annotate | diff | comparison | revisions
--- a/ChangeLog	Wed Dec 30 11:02:01 2020 +0100
+++ b/ChangeLog	Sat Apr 24 17:01:22 2021 +0200
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 7.1.3:
+- implemented some code simplifications
+
 Version 7.1.2:
 - added code to use new functionality available with eric6 20.11
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PluginPyLint.epj	Sat Apr 24 17:01:22 2021 +0200
@@ -0,0 +1,264 @@
+{
+  "header": {
+    "comment": "eric project file for project PluginPyLint",
+    "copyright": "Copyright (C) 2021 Detlev Offenbach, detlev@die-offenbachs.de"
+  },
+  "project": {
+    "AUTHOR": "Detlev Offenbach",
+    "CHECKERSPARMS": {
+      "Pep8Checker": {
+        "AnnotationsChecker": {
+          "AllowUntypedDefs": false,
+          "AllowUntypedNested": false,
+          "DispatchDecorators": [
+            "singledispatch",
+            "singledispatchmethod"
+          ],
+          "MaximumComplexity": 3,
+          "MaximumLength": 7,
+          "MinimumCoverage": 75,
+          "MypyInitReturn": false,
+          "OverloadDecorators": [
+            "overload"
+          ],
+          "SuppressDummyArgs": false,
+          "SuppressNoneReturning": true
+        },
+        "BlankLines": [
+          2,
+          1
+        ],
+        "BuiltinsChecker": {
+          "bytes": [
+            "unicode"
+          ],
+          "chr": [
+            "unichr"
+          ],
+          "str": [
+            "unicode"
+          ]
+        },
+        "CommentedCodeChecker": {
+          "Aggressive": false,
+          "WhiteList": [
+            "pylint",
+            "pyright",
+            "noqa",
+            "type:\\s*ignore",
+            "fmt:\\s*(on|off)",
+            "TODO",
+            "FIXME",
+            "WARNING",
+            "NOTE",
+            "TEST",
+            "DOCU",
+            "XXX",
+            "- "
+          ]
+        },
+        "CopyrightAuthor": "",
+        "CopyrightMinFileSize": 0,
+        "DocstringType": "eric",
+        "EnabledCheckerCategories": "C, D, E, M, N, S, Y, W",
+        "ExcludeFiles": "*/Ui_*.py, */*_rc.py,",
+        "ExcludeMessages": "C101,E265,E266,E305,E402,M201,M301,M302,M303,M304,M305,M306,M307,M308,M311,M312,M313,M314,M315,M321,M701,M702,M811,M834,N802,N803,N807,N808,N821,W293,W504,Y119,Y401,Y402",
+        "FixCodes": "",
+        "FixIssues": false,
+        "FutureChecker": "",
+        "HangClosing": false,
+        "IncludeMessages": "",
+        "LineComplexity": 25,
+        "LineComplexityScore": 10,
+        "MaxCodeComplexity": 10,
+        "MaxDocLineLength": 79,
+        "MaxLineLength": 79,
+        "NoFixCodes": "E501",
+        "RepeatMessages": true,
+        "SecurityChecker": {
+          "CheckTypedException": false,
+          "HardcodedTmpDirectories": [
+            "/tmp",
+            "/var/tmp",
+            "/dev/shm",
+            "~/tmp"
+          ],
+          "InsecureHashes": [
+            "md4",
+            "md5",
+            "sha",
+            "sha1"
+          ],
+          "InsecureSslProtocolVersions": [
+            "PROTOCOL_SSLv2",
+            "SSLv2_METHOD",
+            "SSLv23_METHOD",
+            "PROTOCOL_SSLv3",
+            "PROTOCOL_TLSv1",
+            "SSLv3_METHOD",
+            "TLSv1_METHOD"
+          ],
+          "WeakKeySizeDsaHigh": "1024",
+          "WeakKeySizeDsaMedium": "2048",
+          "WeakKeySizeEcHigh": "160",
+          "WeakKeySizeEcMedium": "224",
+          "WeakKeySizeRsaHigh": "1024",
+          "WeakKeySizeRsaMedium": "2048"
+        },
+        "ShowIgnored": false,
+        "ValidEncodings": "latin-1, utf-8"
+      }
+    },
+    "DESCRIPTION": "This plugin implements an eric5 interface to the pylint checker.",
+    "DOCSTRING": "",
+    "DOCUMENTATIONPARMS": {
+      "ERIC4DOC": {
+        "cssFile": "%PYTHON%/eric6/CSSs/default.css",
+        "ignoreDirectories": [
+          ".ropeproject"
+        ],
+        "ignoreFilePatterns": [
+          "Ui_*"
+        ],
+        "outputDirectory": "PyLint/Documentation/source",
+        "qtHelpEnabled": false,
+        "useRecursion": true
+      }
+    },
+    "EMAIL": "detlev@die-offenbachs.de",
+    "EOL": 1,
+    "FILETYPES": {
+      "*.idl": "INTERFACES",
+      "*.py": "SOURCES",
+      "*.py3": "SOURCES",
+      "*.pyw": "SOURCES",
+      "*.pyw3": "SOURCES",
+      "*.qm": "TRANSLATIONS",
+      "*.qrc": "RESOURCES",
+      "*.ts": "TRANSLATIONS",
+      "*.ui": "FORMS",
+      "*.ui.h": "FORMS",
+      "Ui_*.py": "__IGNORE__"
+    },
+    "FORMS": [
+      "PyLint/PyLintConfigDialog.ui",
+      "PyLint/PyLintExecDialog.ui"
+    ],
+    "HASH": "abcf6641287ab95ca3df062cd9840dd92df2e42f",
+    "IDLPARAMS": {
+      "DefinedNames": [],
+      "IncludeDirs": [],
+      "UndefinedNames": []
+    },
+    "INTERFACES": [],
+    "LEXERASSOCS": {},
+    "MAINSCRIPT": "PluginPyLint.py",
+    "MAKEPARAMS": {
+      "MakeEnabled": false,
+      "MakeExecutable": "",
+      "MakeFile": "",
+      "MakeParameters": "",
+      "MakeTarget": "",
+      "MakeTestOnly": true
+    },
+    "MIXEDLANGUAGE": false,
+    "OTHERS": [
+      ".hgignore",
+      "ChangeLog",
+      "PKGLIST",
+      "PluginPyLint.e4p",
+      "PluginPyLint.zip",
+      "PyLint/Documentation/LICENSE.GPL3",
+      "PyLint/Documentation/source",
+      "PluginPyLint.epj"
+    ],
+    "OTHERTOOLSPARMS": {},
+    "PACKAGERSPARMS": {},
+    "PROGLANGUAGE": "Python3",
+    "PROJECTTYPE": "E6Plugin",
+    "PROJECTTYPESPECIFICDATA": {},
+    "PROTOCOLS": [],
+    "RCCPARAMS": {
+      "CompressLevel": 0,
+      "CompressionDisable": false,
+      "CompressionThreshold": 70,
+      "PathPrefix": ""
+    },
+    "RESOURCES": [],
+    "SOURCES": [
+      "PluginPyLint.py",
+      "PyLint/PyLintConfigDialog.py",
+      "PyLint/PyLintExecDialog.py",
+      "PyLint/__init__.py",
+      "__init__.py"
+    ],
+    "SPELLEXCLUDES": "",
+    "SPELLLANGUAGE": "en_US",
+    "SPELLWORDS": "",
+    "TRANSLATIONEXCEPTIONS": [],
+    "TRANSLATIONPATTERN": "PyLint/i18n/pylint_%language%.ts",
+    "TRANSLATIONS": [
+      "PyLint/i18n/pylint_cs.qm",
+      "PyLint/i18n/pylint_cs.ts",
+      "PyLint/i18n/pylint_de.qm",
+      "PyLint/i18n/pylint_de.ts",
+      "PyLint/i18n/pylint_es.qm",
+      "PyLint/i18n/pylint_es.ts",
+      "PyLint/i18n/pylint_fr.qm",
+      "PyLint/i18n/pylint_fr.ts",
+      "PyLint/i18n/pylint_pt.qm",
+      "PyLint/i18n/pylint_pt.ts",
+      "PyLint/i18n/pylint_ru.qm",
+      "PyLint/i18n/pylint_ru.ts"
+    ],
+    "TRANSLATIONSBINPATH": "",
+    "UICPARAMS": {
+      "Package": "",
+      "PackagesRoot": "",
+      "RcSuffix": ""
+    },
+    "VCS": "Mercurial",
+    "VCSOPTIONS": {
+      "add": [
+        ""
+      ],
+      "checkout": [
+        ""
+      ],
+      "commit": [
+        ""
+      ],
+      "diff": [
+        ""
+      ],
+      "export": [
+        ""
+      ],
+      "global": [
+        ""
+      ],
+      "history": [
+        ""
+      ],
+      "log": [
+        ""
+      ],
+      "remove": [
+        ""
+      ],
+      "status": [
+        ""
+      ],
+      "tag": [
+        ""
+      ],
+      "update": [
+        ""
+      ]
+    },
+    "VCSOTHERDATA": {
+      "standardLayout": true
+    },
+    "VERSION": "6.0.x"
+  }
+}
\ No newline at end of file
--- 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")
Binary file PluginPyLint.zip has changed
--- a/PyLint/Documentation/source/Plugin_Checker_PyLint.PluginPyLint.html	Wed Dec 30 11:02:01 2020 +0100
+++ b/PyLint/Documentation/source/Plugin_Checker_PyLint.PluginPyLint.html	Sat Apr 24 17:01:22 2021 +0200
@@ -348,7 +348,7 @@
         Public method to activate this plugin.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 tuple of None and activation status (boolean)
 </dd>
@@ -378,7 +378,7 @@
 </dd>
 </dl>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 version string of detected version (string)
 </dd>
@@ -394,7 +394,7 @@
     Restricted function to check the availability of pylint.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 flag indicating availability (boolean)
 </dd>
@@ -417,7 +417,7 @@
 </dd>
 </dl>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 path name of the executable (string)
 </dd>
@@ -433,7 +433,7 @@
     Public method to support the display of some executable info.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 dictionary containing the data to query the presence of
         the executable
--- a/PyLint/Documentation/source/Plugin_Checker_PyLint.PyLint.PyLintConfigDialog.html	Wed Dec 30 11:02:01 2020 +0100
+++ b/PyLint/Documentation/source/Plugin_Checker_PyLint.PyLint.PyLintConfigDialog.html	Sat Apr 24 17:01:22 2021 +0200
@@ -216,7 +216,7 @@
         executable as the first parameter.
 </p>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 a tuple of the commandline parameters and non default
             parameters (list of strings, dictionary)
--- a/PyLint/Documentation/source/Plugin_Checker_PyLint.PyLint.PyLintExecDialog.html	Wed Dec 30 11:02:01 2020 +0100
+++ b/PyLint/Documentation/source/Plugin_Checker_PyLint.PyLint.PyLintExecDialog.html	Sat Apr 24 17:01:22 2021 +0200
@@ -293,7 +293,7 @@
 </dd>
 </dl>
 <dl>
-<dt>Returns:</dt>
+<dt>Return:</dt>
 <dd>
 flag indicating the successful start of the process (boolean)
 </dd>
--- a/PyLint/PyLintConfigDialog.py	Wed Dec 30 11:02:01 2020 +0100
+++ b/PyLint/PyLintConfigDialog.py	Sat Apr 24 17:01:22 2021 +0200
@@ -37,7 +37,7 @@
         @param parms parameters to set in the dialog
         @param version pylint version (string)
         """
-        super(PyLintConfigDialog, self).__init__(None)
+        super().__init__(None)
         self.setupUi(self)
         
         self.version = version
@@ -304,7 +304,7 @@
             [m.strip() for m in self.disabledMessagesEdit.text().split(',')])
         
         # call the accept slot of the base class
-        super(PyLintConfigDialog, self).accept()
+        super().accept()
 
     ###########################################################################
     ## Methods below are needed to generate a configuration file template
--- a/PyLint/PyLintExecDialog.py	Wed Dec 30 11:02:01 2020 +0100
+++ b/PyLint/PyLintExecDialog.py	Sat Apr 24 17:01:22 2021 +0200
@@ -9,7 +9,7 @@
 
 import os
 
-from PyQt5.QtCore import  pyqtSlot, Qt, QTimer, QProcess
+from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QProcess
 from PyQt5.QtGui import QTextCursor
 from PyQt5.QtWidgets import (
     QWidget, QHeaderView, QApplication, QDialogButtonBox, QTreeWidgetItem
@@ -394,10 +394,11 @@
         """
         Private slot to save the report to a file.
         """
-        if self.htmlOutput:
-            fileFilter = self.tr("HTML Files (*.html);;All Files (*)")
-        else:
-            fileFilter = self.tr("Text Files (*.txt);;All Files (*)")
+        fileFilter = (
+            self.tr("HTML Files (*.html);;All Files (*)")
+            if self.htmlOutput else
+            self.tr("Text Files (*.txt);;All Files (*)")
+        )
         
         self.reportFile = E5FileDialog.getSaveFileName(
             self,

eric ide

mercurial