src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

branch
eric7
changeset 9289
ba49c41e8f63
parent 9284
3b3a4f659782
child 9292
a5c8a0213fe3
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Tue Aug 16 13:14:42 2022 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Tue Aug 16 19:07:16 2022 +0200
@@ -224,10 +224,11 @@
     taskQueue = multiprocessing.Queue()
     doneQueue = multiprocessing.Queue()
 
-    # Submit tasks (initially two time number of processes
+    # Submit tasks (initially two times the number of processes)
+    tasks = len(argumentsList)
     initialTasks = 2 * NumberOfProcesses
-    for task in argumentsList[:initialTasks]:
-        taskQueue.put(task)
+    for _ in range(initialTasks):
+        taskQueue.put(argumentsList.pop(0))
 
     # Start worker processes
     workers = [
@@ -238,8 +239,7 @@
         worker.start()
 
     # Get and send results
-    endIndex = len(argumentsList) - initialTasks
-    for i in range(len(argumentsList)):
+    for _ in range(tasks):
         resultSent = False
         wasCancelled = False
 
@@ -259,8 +259,8 @@
             # just exit the loop ignoring the results of queued tasks
             break
 
-        if i < endIndex:
-            taskQueue.put(argumentsList[i + initialTasks])
+        if argumentsList:
+            taskQueue.put(argumentsList.pop(0))
 
     # Tell child processes to stop
     for _ in range(NumberOfProcesses):

eric ide

mercurial