Fixed some code style issues detected by the new checks. eric7

Thu, 15 Sep 2022 11:00:36 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 15 Sep 2022 11:00:36 +0200
branch
eric7
changeset 9328
49a0a9cb2505
parent 9327
2b768afcaee1
child 9329
bd8e621c3c20

Fixed some code style issues detected by the new checks.

scripts/install-debugclients.py file | annotate | diff | comparison | revisions
scripts/install-dependencies.py file | annotate | diff | comparison | revisions
scripts/install-i18n.py file | annotate | diff | comparison | revisions
scripts/install.py file | annotate | diff | comparison | revisions
scripts/uninstall-debugclients.py file | annotate | diff | comparison | revisions
scripts/uninstall.py file | annotate | diff | comparison | revisions
src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py file | annotate | diff | comparison | revisions
src/eric7/Utilities/BackgroundService.py file | annotate | diff | comparison | revisions
src/eric7/WebBrowser/AdBlock/AdBlockSubscription.py file | annotate | diff | comparison | revisions
--- a/scripts/install-debugclients.py	Thu Sep 15 10:09:53 2022 +0200
+++ b/scripts/install-debugclients.py	Thu Sep 15 11:00:36 2022 +0200
@@ -42,7 +42,7 @@
     global currDir
 
     if sys.platform.startswith("win"):
-        with contextlib.suppress():
+        with contextlib.suppress(EOFError):
             input("Press enter to continue...")  # secok
 
     os.chdir(currDir)
--- a/scripts/install-dependencies.py	Thu Sep 15 10:09:53 2022 +0200
+++ b/scripts/install-dependencies.py	Thu Sep 15 11:00:36 2022 +0200
@@ -23,7 +23,7 @@
     print()
 
     if sys.platform.startswith(("win", "cygwin")):
-        with contextlib.suppress():
+        with contextlib.suppress(EOFError):
             input("Press enter to continue...")  # secok
 
     sys.exit(rcode)
--- a/scripts/install-i18n.py	Thu Sep 15 10:09:53 2022 +0200
+++ b/scripts/install-i18n.py	Thu Sep 15 11:00:36 2022 +0200
@@ -9,10 +9,10 @@
 Installation script for the eric IDE translation files.
 """
 
-import sys
+import glob
 import os
 import shutil
-import glob
+import sys
 
 try:
     from eric7config import getConfig
@@ -76,11 +76,12 @@
             shutil.copy2(fn, targetDir)
             os.chmod(os.path.join(targetDir, os.path.basename(fn)), 0o644)
     except OSError as msg:
-        sys.stderr.write("OSError: {0}\nTry install-i18n as root.\n".format(msg))
-    except OSError as msg:
-        sys.stderr.write(
-            "OSError: {0}\nTry install-i18n with admin rights.\n".format(msg)
-        )
+        if sys.platform.startswith(("win", "cygwin")):
+            sys.stderr.write(
+                "OSError: {0}\nTry install-i18n with admin rights.\n".format(msg)
+            )
+        else:
+            sys.stderr.write("OSError: {0}\nTry install-i18n as root.\n".format(msg))
 
 
 def main(argv):
--- a/scripts/install.py	Thu Sep 15 10:09:53 2022 +0200
+++ b/scripts/install.py	Thu Sep 15 11:00:36 2022 +0200
@@ -100,7 +100,7 @@
     print()
 
     if sys.platform.startswith(("win", "cygwin")):
-        with contextlib.suppress():
+        with contextlib.suppress(EOFError):
             input("Press enter to continue...")  # secok
 
     os.chdir(currDir)
--- a/scripts/uninstall-debugclients.py	Thu Sep 15 10:09:53 2022 +0200
+++ b/scripts/uninstall-debugclients.py	Thu Sep 15 11:00:36 2022 +0200
@@ -33,7 +33,7 @@
     global currDir
 
     if sys.platform.startswith("win"):
-        with contextlib.suppress():
+        with contextlib.suppress(EOFError):
             input("Press enter to continue...")  # secok
 
     os.chdir(currDir)
--- a/scripts/uninstall.py	Thu Sep 15 10:09:53 2022 +0200
+++ b/scripts/uninstall.py	Thu Sep 15 11:00:36 2022 +0200
@@ -43,7 +43,7 @@
         os.rename("eric7config.py.orig", "eric7config.py")
 
     if sys.platform.startswith(("win", "cygwin")):
-        with contextlib.suppress():
+        with contextlib.suppress(EOFError):
             input("Press enter to continue...")  # secok
 
     os.chdir(currDir)
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py	Thu Sep 15 10:09:53 2022 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py	Thu Sep 15 11:00:36 2022 +0200
@@ -369,7 +369,7 @@
         else:
             self.__error(arg.lineno - 1, arg.col_offset, errorCode)
 
-    @lru_cache()
+    @lru_cache()  # __IGNORE_WARNING_M519__
     def __returnErrorClassifier(self, isClassMethod, classDecoratorType, functionType):
         """
         Private method to classify a return type annotation issue.
@@ -400,7 +400,7 @@
         else:
             return "A201"
 
-    @lru_cache()
+    @lru_cache()  # __IGNORE_WARNING_M519__
     def __argumentErrorClassifier(
         self, isClassMethod, isFirstArg, classDecoratorType, annotationType
     ):
--- a/src/eric7/Utilities/BackgroundService.py	Thu Sep 15 10:09:53 2022 +0200
+++ b/src/eric7/Utilities/BackgroundService.py	Thu Sep 15 11:00:36 2022 +0200
@@ -69,7 +69,7 @@
         ## Note: Need the port if started external in debugger:
         print("Background Service listening on: {0:d}".format(port))
         # __IGNORE_WARNING__
-        
+
         interpreter = self.__getPythonInterpreter()
         if interpreter:
             process = self.__startExternalClient(interpreter, port)
@@ -80,7 +80,7 @@
         """
         Private method to generate the path of the Python interpreter to be
         used to run the background client.
-        
+
         @return path of the Python interpreter
         @rtype str
         """
--- a/src/eric7/WebBrowser/AdBlock/AdBlockSubscription.py	Thu Sep 15 10:09:53 2022 +0200
+++ b/src/eric7/WebBrowser/AdBlock/AdBlockSubscription.py	Thu Sep 15 11:00:36 2022 +0200
@@ -512,7 +512,7 @@
         try:
             with open(fileName, "r", encoding="utf-8") as f:
                 data = f.read()
-        except (OSError, OSError):
+        except OSError:
             return False
 
         match = re.search(self.__checksumRe, data)

eric ide

mercurial