Did some code optimizations in the code style checker. eric7

Tue, 12 Jul 2022 17:31:17 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 12 Jul 2022 17:31:17 +0200
branch
eric7
changeset 9219
964a326c58d4
parent 9218
71cf3979a6c9
child 9220
e9e7eca7efee

Did some code optimizations in the code style checker.

src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py file | annotate | diff | comparison | revisions
src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py file | annotate | diff | comparison | revisions
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Tue Jul 12 16:26:22 2022 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Tue Jul 12 17:31:17 2022 +0200
@@ -223,8 +223,8 @@
 
     # Submit tasks (initially two time number of processes
     initialTasks = 2 * NumberOfProcesses
-    for task in argumentsList[:initialTasks]:
-        taskQueue.put(task)
+    for _ in range(initialTasks):
+        taskQueue.put(argumentsList.pop(0))
 
     # Start worker processes
     workers = [
@@ -258,7 +258,7 @@
             break
         
         if i < endIndex:
-            taskQueue.put(argumentsList[i + initialTasks])
+            taskQueue.put(argumentsList.pop(0))
 
     # Tell child processes to stop
     for _ in range(NumberOfProcesses):
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Tue Jul 12 16:26:22 2022 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Tue Jul 12 17:31:17 2022 +0200
@@ -747,6 +747,10 @@
         self.__cleanupData()
         self.__prepareProgress()
         
+        # disable updates of the list for speed
+        self.resultList.setUpdatesEnabled(False)
+        self.resultList.setSortingEnabled(False)
+        
         if len(self.files) > 0:
             self.securityNoteLabel.setVisible(
                 "S" in self.__getCategories(True, asList=True))
@@ -1060,10 +1064,6 @@
         if not self.__batch and fn != self.filename:
             return
         
-        # disable updates of the list for speed
-        self.resultList.setUpdatesEnabled(False)
-        self.resultList.setSortingEnabled(False)
-        
         fixed = None
         ignoredErrors = collections.defaultdict(int)
         securityOk = 0
@@ -1102,12 +1102,6 @@
                 editor.refresh()
         
         self.progress += 1
-        
-        self.__resort()
-        # reenable updates of the list
-        self.resultList.setSortingEnabled(True)
-        self.resultList.setUpdatesEnabled(True)
-        
         self.__updateProgress(fn)
         
         if not self.__batch:
@@ -1180,6 +1174,10 @@
             self.checkProgress.setVisible(False)
             self.checkProgressLabel.setVisible(False)
             
+            self.__resort()
+            self.resultList.setUpdatesEnabled(True)
+            self.resultList.setSortingEnabled(True)
+            
             self.mainWidget.setCurrentWidget(self.resultsTab)
     
     def __getEol(self, fn):

eric ide

mercurial