eric6/Plugins/PluginCodeStyleChecker.py

changeset 7635
0cdead130a81
parent 7613
382f89c11e27
child 7637
c878e8255972
diff -r 8c3d033e5044 -r 0cdead130a81 eric6/Plugins/PluginCodeStyleChecker.py
--- a/eric6/Plugins/PluginCodeStyleChecker.py	Sat Jun 20 17:36:20 2020 +0200
+++ b/eric6/Plugins/PluginCodeStyleChecker.py	Sun Jun 21 18:26:12 2020 +0200
@@ -72,11 +72,6 @@
         path = os.path.join(
             os.path.dirname(__file__), 'CheckerPlugins', 'CodeStyleChecker')
         self.backgroundService.serviceConnect(
-            'style', 'Python2', path, 'CodeStyleChecker',
-            self.__translateStyleCheck,
-            onErrorCallback=self.serviceErrorPy2,
-            onBatchDone=self.batchJobDone)
-        self.backgroundService.serviceConnect(
             'style', 'Python3', path, 'CodeStyleChecker',
             self.__translateStyleCheck,
             onErrorCallback=self.serviceErrorPy3,
@@ -96,22 +91,6 @@
         """
         self.error.emit(fn, msg)
     
-    def serviceErrorPy2(self, fx, lang, fn, msg):
-        """
-        Public slot handling service errors for Python 2.
-        
-        @param fx service name (string)
-        @param lang language (string)
-        @param fn file name (string)
-        @param msg message text (string)
-        """
-        if fx in ['style', 'batch_style'] and lang == 'Python2':
-            if fx == 'style':
-                self.__serviceError(fn, msg)
-            else:
-                self.__serviceError(self.tr("Python 2 batch check"), msg)
-                self.batchJobDone(fx, lang)
-    
     def serviceErrorPy3(self, fx, lang, fn, msg):
         """
         Public slot handling service errors for Python 2.
@@ -179,7 +158,7 @@
         """
         if lang is None:
             lang = 'Python{0}'.format(determinePythonVersion(filename, source))
-        if lang not in ['Python2', 'Python3']:
+        if lang != 'Python3':
             return
         
         data = [source, args]
@@ -195,30 +174,27 @@
         @type list of tuple of (str, str, list)
         """
         data = {
-            "Python2": [],
             "Python3": [],
         }
         for filename, source, args in argumentsList:
             lang = 'Python{0}'.format(determinePythonVersion(filename, source))
-            if lang not in ['Python2', 'Python3']:
+            if lang != 'Python3':
                 continue
             else:
                 data[lang].append((filename, source, args))
         
         self.queuedBatches = []
-        for lang in ['Python2', 'Python3']:
-            if data[lang]:
-                self.queuedBatches.append(lang)
-                self.backgroundService.enqueueRequest('batch_style', lang, "",
-                                                      data[lang])
-                self.batchesFinished = False
+        if data['Python3']:
+            self.queuedBatches.append('Python3')
+            self.backgroundService.enqueueRequest('batch_style', 'Python3', "",
+                                                  data['Python3'])
+            self.batchesFinished = False
     
     def cancelStyleBatchCheck(self):
         """
         Public method to cancel all batch jobs.
         """
-        for lang in ['Python2', 'Python3']:
-            self.backgroundService.requestCancel('batch_style', lang)
+        self.backgroundService.requestCancel('batch_style', 'Python3')
     
     def __translateStyleCheck(self, fn, codeStyleCheckerStats, results):
         """
@@ -340,7 +316,7 @@
         if menuName == "Checks" and self.__projectAct is not None:
             self.__projectAct.setEnabled(
                 e5App().getObject("Project").getProjectLanguage() in
-                ["Python3", "Python2", "Python", "MicroPython"])
+                ["Python3", "MicroPython"])
     
     def __projectBrowserShowMenu(self, menuName, menu):
         """
@@ -353,7 +329,7 @@
         if (
             menuName == "Checks" and
             e5App().getObject("Project").getProjectLanguage() in
-                ["Python3", "Python2", "Python", "MicroPython"]
+                ["Python3", "MicroPython"]
         ):
             self.__projectBrowserMenu = menu
             if self.__projectBrowserAct is None:

eric ide

mercurial