eric6/Tasks/TaskViewer.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8176
31965986ecd1
parent 8220
006ee31b4835
child 8400
b3eefd7e58d1
diff -r fb0ef164f536 -r 698ae46f40a4 eric6/Tasks/TaskViewer.py
--- a/eric6/Tasks/TaskViewer.py	Fri Apr 02 11:59:41 2021 +0200
+++ b/eric6/Tasks/TaskViewer.py	Sat May 01 14:27:20 2021 +0200
@@ -50,7 +50,7 @@
         @param parent the parent (QWidget)
         @param project reference to the project object
         """
-        super(TaskViewer, self).__init__(parent)
+        super().__init__(parent)
         
         self.setSortingEnabled(True)
         self.setExpandsOnDoubleClick(False)
@@ -732,10 +732,9 @@
                 self.tr("Abort"), 0, len(files), self.tr("%v/%m Files"))
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Tasks"))
-            count = 0
             
             ppath = self.project.getProjectPath()
-            for file in files:
+            for count, file in enumerate(files):
                 progress.setLabelText(
                     self.tr("Extracting project tasks...\n{0}").format(file))
                 progress.setValue(count)
@@ -754,9 +753,7 @@
                     continue
                 
                 # now search tasks and record them
-                lineIndex = 0
-                for line in lines:
-                    lineIndex += 1
+                for lineIndex, line in enumerate(lines, start=1):
                     shouldBreak = False
                     
                     if line.endswith("__NO-TASK__"):
@@ -773,8 +770,6 @@
                                 break
                         if shouldBreak:
                             break
-                
-                count += 1
             
             progress.setValue(len(files))
     
@@ -833,7 +828,7 @@
         
         @param parent reference to the parent object (QObject)
         """
-        super(ProjectTaskExtractionThread, self).__init__()
+        super().__init__()
         
         self.__lock = threading.Lock()
         self.__interrupt = False
@@ -886,12 +881,10 @@
                 continue
             
             # now search tasks and record them
-            lineIndex = 0
-            for line in lines:
+            for lineIndex, line in enumerate(lines, start=1):
                 if self.__interrupt:
                     break
                 
-                lineIndex += 1
                 found = False
                 
                 if line.endswith("__NO-TASK__"):

eric ide

mercurial