eric6/WebBrowser/SafeBrowsing/SafeBrowsingManager.py

changeset 8220
006ee31b4835
parent 8218
7c09585bd960
child 8260
2161475d9639
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingManager.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingManager.py	Sun Apr 11 12:38:16 2021 +0200
@@ -267,10 +267,8 @@
             return False, error
         
         maximum = len(threatLists)
-        current = 0
         self.progressMessage.emit(self.tr("Updating threat lists"), maximum)
-        for entry in threatLists:
-            current += 1
+        for current, entry in enumerate(threatLists, start=1):
             self.progress.emit(current)
             QCoreApplication.processEvents()
             threatList = ThreatList.fromApiEntry(entry)
@@ -282,12 +280,13 @@
                 key = repr(threatList)
                 if key in threatListsForRemove:
                     del threatListsForRemove[key]
+        
         maximum = len(threatListsForRemove.values())
-        current = 0
         self.progressMessage.emit(self.tr("Deleting obsolete threat lists"),
                                   maximum)
-        for threatList in threatListsForRemove.values():
-            current += 1
+        for current, threatList in enumerate(
+            threatListsForRemove.values(), start=1
+        ):
             self.progress.emit(current)
             QCoreApplication.processEvents()
             self.__cache.deleteHashPrefixList(threatList)
@@ -305,10 +304,8 @@
             return False, error
         
         maximum = len(threatsUpdateResponses)
-        current = 0
         self.progressMessage.emit(self.tr("Updating hash prefixes"), maximum)
-        for response in threatsUpdateResponses:
-            current += 1
+        for current, response in enumerate(threatsUpdateResponses, start=1):
             self.progress.emit(current)
             QCoreApplication.processEvents()
             responseThreatList = ThreatList.fromApiEntry(response)

eric ide

mercurial