Applied some more code simplifications suggested by the new Simplify checker (Y113: use enumerate()).

Sun, 11 Apr 2021 12:38:16 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 11 Apr 2021 12:38:16 +0200
changeset 8220
006ee31b4835
parent 8219
013aee248a62
child 8221
0572a215bd2f

Applied some more code simplifications suggested by the new Simplify checker (Y113: use enumerate()).

eric6/DebugClients/Python/DebugVariables.py file | annotate | diff | comparison | revisions
eric6/DocumentationTools/QtHelpGenerator.py file | annotate | diff | comparison | revisions
eric6/Graphics/ApplicationDiagramBuilder.py file | annotate | diff | comparison | revisions
eric6/Graphics/PackageDiagramBuilder.py file | annotate | diff | comparison | revisions
eric6/Graphics/UMLGraphicsView.py file | annotate | diff | comparison | revisions
eric6/HexEdit/HexEditMainWindow.py file | annotate | diff | comparison | revisions
eric6/MicroPython/PyBoardDevices.py file | annotate | diff | comparison | revisions
eric6/MultiProject/MultiProject.py file | annotate | diff | comparison | revisions
eric6/PluginManager/PluginInstallDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/djangoXssVulnerability.py file | annotate | diff | comparison | revisions
eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/HgSummaryDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsPySvn/SvnPropListDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py file | annotate | diff | comparison | revisions
eric6/Preferences/ToolConfigurationDialog.py file | annotate | diff | comparison | revisions
eric6/Preferences/__init__.py file | annotate | diff | comparison | revisions
eric6/Project/Project.py file | annotate | diff | comparison | revisions
eric6/Project/ProjectFormsBrowser.py file | annotate | diff | comparison | revisions
eric6/Project/ProjectInterfacesBrowser.py file | annotate | diff | comparison | revisions
eric6/Project/ProjectProtocolsBrowser.py file | annotate | diff | comparison | revisions
eric6/Project/ProjectResourcesBrowser.py file | annotate | diff | comparison | revisions
eric6/QScintilla/Editor.py file | annotate | diff | comparison | revisions
eric6/QScintilla/EditorAssembly.py file | annotate | diff | comparison | revisions
eric6/QScintilla/Lexers/SubstyledLexer.py file | annotate | diff | comparison | revisions
eric6/QScintilla/ShellWindow.py file | annotate | diff | comparison | revisions
eric6/Tasks/TaskViewer.py file | annotate | diff | comparison | revisions
eric6/Templates/TemplateMultipleVariablesDialog.py file | annotate | diff | comparison | revisions
eric6/Templates/TemplateViewer.py file | annotate | diff | comparison | revisions
eric6/Tools/TrayStarter.py file | annotate | diff | comparison | revisions
eric6/UI/CompareDialog.py file | annotate | diff | comparison | revisions
eric6/UI/DiffDialog.py file | annotate | diff | comparison | revisions
eric6/UI/FindFileDialog.py file | annotate | diff | comparison | revisions
eric6/UI/UserInterface.py file | annotate | diff | comparison | revisions
eric6/Utilities/crypto/py3AES.py file | annotate | diff | comparison | revisions
eric6/ViewManager/ViewManager.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/AdBlock/AdBlockTreeWidget.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/History/HistoryMenu.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/Navigation/NavigationBar.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/Passwords/PasswordManager.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/SafeBrowsing/SafeBrowsingManager.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/WebBrowserTabWidget.py file | annotate | diff | comparison | revisions
--- a/eric6/DebugClients/Python/DebugVariables.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/DebugClients/Python/DebugVariables.py	Sun Apr 11 12:38:16 2021 +0200
@@ -717,3 +717,6 @@
             resolver = defaultResolver
     
     return typeName, typeStr, resolver
+
+#
+# eflag: noqa = Y113
--- a/eric6/DocumentationTools/QtHelpGenerator.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/DocumentationTools/QtHelpGenerator.py	Sun Apr 11 12:38:16 2021 +0200
@@ -175,8 +175,7 @@
             joinext("index", ".html") or
             joinext("index-{0}".format(package), ".html"))
         for subpack in sorted(self.packages[package]["subpackages"]):
-            s += self.__generateSections(subpack, level + 1)
-            s += '\n'
+            s += self.__generateSections(subpack, level + 1) + '\n'
         for mod in sorted(self.packages[package]["modules"]):
             s += indent1 + '<section title="{0}" ref="{1}" />\n'.format(
                 mod, joinext(mod, ".html"))
@@ -220,7 +219,7 @@
             if not basename.endswith("."):
                 basename = "{0}.".format(basename)
         
-        sections = self.__generateSections("00index", 3)
+        sections = self.__generateSections("00index", level=3)
         filesList = sorted(e for e in os.listdir(self.htmlDir)
                            if e.endswith('.html'))
         files = "\n".join(
--- a/eric6/Graphics/ApplicationDiagramBuilder.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Graphics/ApplicationDiagramBuilder.py	Sun Apr 11 12:38:16 2021 +0200
@@ -68,14 +68,12 @@
             None, 0, tot, self.tr("%v/%m Modules"), self.parent())
         progress.setWindowTitle(self.tr("Application Diagram"))
         try:
-            prog = 0
             progress.show()
             QApplication.processEvents()
             
-            for module in modules:
+            for prog, module in enumerate(modules):
                 progress.setValue(prog)
                 QApplication.processEvents()
-                prog += 1
                 if module.endswith("__init__.py"):
                     continue
                 try:
--- a/eric6/Graphics/PackageDiagramBuilder.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Graphics/PackageDiagramBuilder.py	Sun Apr 11 12:38:16 2021 +0200
@@ -93,14 +93,12 @@
             None, 0, tot, self.tr("%v/%m Modules"), self.parent())
         progress.setWindowTitle(self.tr("Package Diagram"))
         try:
-            prog = 0
             progress.show()
             QApplication.processEvents()
             
-            for module in modules:
+            for prog, module in enumerate(modules):
                 progress.setValue(prog)
                 QApplication.processEvents()
-                prog += 1
                 try:
                     mod = Utilities.ModuleParser.readModule(
                         module, extensions=extensions, caching=False)
@@ -158,7 +156,6 @@
             None, 0, tot, self.tr("%v/%m Modules"), self.parent())
         progress.setWindowTitle(self.tr("Package Diagram"))
         try:
-            prog = 0
             progress.show()
             QApplication.processEvents()
             
@@ -169,10 +166,9 @@
                 for ext in supportedExt:
                     modules.extend(glob.glob(
                         Utilities.normjoinpath(subpackage, ext)))
-                for module in modules:
+                for prog, module in enumerate(modules):
                     progress.setValue(prog)
                     QApplication.processEvents()
-                    prog += 1
                     try:
                         mod = Utilities.ModuleParser.readModule(
                             module, extensions=extensions, caching=False)
--- a/eric6/Graphics/UMLGraphicsView.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Graphics/UMLGraphicsView.py	Sun Apr 11 12:38:16 2021 +0200
@@ -740,9 +740,7 @@
         from .PackageItem import PackageItem
         from .AssociationItem import AssociationItem
         
-        linenum = 0
-        for line in data[1:]:
-            linenum += 1
+        for linenum, line in enumerate(data[1:], start=1):
             if not line.startswith(("item:", "association:")):
                 return False, linenum
             
--- a/eric6/HexEdit/HexEditMainWindow.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/HexEdit/HexEditMainWindow.py	Sun Apr 11 12:38:16 2021 +0200
@@ -1417,8 +1417,7 @@
         
         self.__recentMenu.clear()
         
-        idx = 1
-        for rs in self.__recent:
+        for idx, rs in enumerate(self.__recent, start=1):
             if idx < 10:
                 formatStr = '&{0:d}. {1}'
             else:
@@ -1430,7 +1429,6 @@
                         rs, HexEditMainWindow.maxMenuFilePathLen)))
             act.setData(rs)
             act.setEnabled(QFileInfo(rs).exists())
-            idx += 1
         
         self.__recentMenu.addSeparator()
         self.__recentMenu.addAction(self.tr('&Clear'), self.__clearRecent)
--- a/eric6/MicroPython/PyBoardDevices.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/MicroPython/PyBoardDevices.py	Sun Apr 11 12:38:16 2021 +0200
@@ -44,8 +44,7 @@
         @param parent reference to the parent object
         @type QObject
         """
-        super().__init__(microPythonWidget, deviceType,
-                                            parent)
+        super().__init__(microPythonWidget, deviceType, parent)
         
         self.__workspace = self.__findWorkspace()
     
--- a/eric6/MultiProject/MultiProject.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/MultiProject/MultiProject.py	Sun Apr 11 12:38:16 2021 +0200
@@ -911,8 +911,7 @@
         
         self.recentMenu.clear()
         
-        idx = 1
-        for rp in self.recent:
+        for idx, rp in enumerate(self.recent, start=1):
             if idx < 10:
                 formatStr = '&{0:d}. {1}'
             else:
@@ -923,7 +922,6 @@
                     Utilities.compactPath(rp, self.ui.maxMenuFilePathLen)))
             act.setData(rp)
             act.setEnabled(QFileInfo(rp).exists())
-            idx += 1
         
         self.recentMenu.addSeparator()
         self.recentMenu.addAction(self.tr('&Clear'), self.clearRecent)
--- a/eric6/PluginManager/PluginInstallDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/PluginManager/PluginInstallDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -442,13 +442,11 @@
             if packageName != "None":
                 namelist = sorted(zipFile.namelist())
                 tot = len(namelist)
-                prog = 0
                 self.progress.setMaximum(tot)
                 QApplication.processEvents()
-                for name in namelist:
+                for prog, name in enumerate(namelist):
                     self.progress.setValue(prog)
                     QApplication.processEvents()
-                    prog += 1
                     if (
                         name == pluginFileName or
                         name.startswith("{0}/".format(packageName)) or
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/djangoXssVulnerability.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/djangoXssVulnerability.py	Sun Apr 11 12:38:16 2021 +0200
@@ -204,12 +204,10 @@
                 if target.id == self.__varName.id:
                     assigned = node.value
             elif isinstance(target, ast.Tuple):
-                pos = 0
-                for name in target.elts:
+                for pos, name in enumerate(target.elts):
                     if name.id == self.__varName.id:
                         assigned = node.value.elts[pos]
                         break
-                    pos += 1
         
         return assigned
 
--- a/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -281,11 +281,9 @@
         self.__lastFileItem = None
         
         self.checkProgressLabel.setPath(self.tr("Preparing files..."))
-        progress = 0
         
         argumentsList = []
-        for filename in self.files:
-            progress += 1
+        for progress, filename in enumerate(self.files, start=1):
             self.checkProgress.setValue(progress)
             QApplication.processEvents()
             
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgSummaryDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgSummaryDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -224,9 +224,9 @@
         # step 2: build the output
         if infoDict:
             info = ["<table>"]
-            pindex = 0
-            for rev, node, tags, message, remarks in infoDict["parent"]:
-                pindex += 1
+            for pindex, (rev, node, tags, message, remarks) in enumerate(
+                infoDict["parent"], start=1
+            ):
                 changeset = "{0}:{1}".format(rev, node)
                 if len(infoDict["parent"]) > 1:
                     info.append(self.tr(
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py	Sun Apr 11 12:38:16 2021 +0200
@@ -1214,9 +1214,7 @@
         
         infoBlock = []
         if output:
-            index = 0
-            for line in output.splitlines():
-                index += 1
+            for index, line in enumerate(output.splitlines(), start=1):
                 (changeset, tags, author, date, branches,
                  bookmarks) = line.split("@@@")
                 cdate, ctime = date.split()[:2]
@@ -1707,9 +1705,7 @@
         output, error = self.__client.runcommand(args)
         
         if output:
-            index = 0
-            for line in output.splitlines():
-                index += 1
+            for index, line in enumerate(output.splitlines(), start=1):
                 (changeset, tags, author, date, branches, parents,
                  bookmarks) = line.split("@@@")
                 cdate, ctime = date.split()[:2]
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -252,8 +252,7 @@
                                     tmpdir, name,
                                     revision1=rev1, revision2=rev2,
                                     recurse=recurse)
-                        counter = 0
-                        for line in diffText.splitlines():
+                        for counter, line in enumerate(diffText.splitlines()):
                             if (
                                 line.startswith("--- ") or
                                 line.startswith("+++ ")
@@ -262,10 +261,8 @@
                             
                             self.__appendText(
                                 "{0}{1}".format(line, os.linesep))
-                            counter += 1
-                            if counter == 30:
+                            if counter % 30 == 0:
                                 # check for cancel every 30 lines
-                                counter = 0
                                 if self._clientCancelCallback():
                                     break
                         if self._clientCancelCallback():
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnPropListDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnPropListDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -124,15 +124,12 @@
             try:
                 for name in fnames:
                     proplist = self.client.proplist(name, recurse=recursive)
-                    counter = 0
-                    for path, prop in proplist:
+                    for counter, (path, prop) in enumerate(proplist):
                         for propName, propVal in list(prop.items()):
                             self.__generateItem(path, propName, propVal)
                             self.propsFound = True
-                        counter += 1
-                        if counter == 30:
+                        if counter % 30 == 0:
                             # check for cancel every 30 items
-                            counter = 0
                             if self._clientCancelCallback():
                                 break
                     if self._clientCancelCallback():
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -345,8 +345,7 @@
                         allFiles = self.client.status(
                             name, recurse=recurse, get_all=verbose,
                             ignore=True, update=update)
-                        counter = 0
-                        for file in allFiles:
+                        for counter, file in enumerate(allFiles):
                             uptodate = True
                             if (
                                 file.repos_text_status !=
@@ -440,10 +439,8 @@
                                 file.entry.commit_author if file.entry else "",
                                 file.path
                             )
-                            counter += 1
-                            if counter == 30:
+                            if counter % 30 == 0:
                                 # check for cancel every 30 items
-                                counter = 0
                                 if self._clientCancelCallback():
                                     break
                         if self._clientCancelCallback():
--- a/eric6/Preferences/ToolConfigurationDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Preferences/ToolConfigurationDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -69,11 +69,9 @@
         @param shortName short name of the mode (string)
         @return index of the mode (integer)
         """
-        ind = 0
-        for mode in self.redirectionModes:
+        for ind, mode in enumerate(self.redirectionModes):
             if mode[0] == shortName:
                 return ind
-            ind += 1
         return 1    # default is "show output"
         
     @pyqtSlot()
--- a/eric6/Preferences/__init__.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Preferences/__init__.py	Sun Apr 11 12:38:16 2021 +0200
@@ -1574,14 +1574,12 @@
     
     # second step, write the tool group entries
     prefClass.settings.setValue("Toolgroups/Groups", len(toolGroups))
-    groupIndex = 0
-    for group in toolGroups:
+    for groupIndex, group in enumerate(toolGroups):
         prefClass.settings.setValue(
             "Toolgroups/{0:02d}/Name".format(groupIndex), group[0])
         prefClass.settings.setValue(
             "Toolgroups/{0:02d}/Items".format(groupIndex), len(group[1]))
-        ind = 0
-        for tool in group[1]:
+        for ind, tool in enumerate(group[1]):
             prefClass.settings.setValue(
                 "Toolgroups/{0:02d}/{1:02d}/Menutext".format(groupIndex, ind),
                 tool['menutext'])
@@ -1598,8 +1596,6 @@
             prefClass.settings.setValue(
                 "Toolgroups/{0:02d}/{1:02d}/Redirect".format(groupIndex, ind),
                 tool['redirect'])
-            ind += 1
-        groupIndex += 1
     prefClass.settings.setValue("Toolgroups/Current Group", currentGroup)
     
 
@@ -2891,20 +2887,17 @@
         # value is list of tuples of (keyword, engine name)
         prefClass.settings.remove("WebBrowser/" + key)
         prefClass.settings.beginWriteArray("WebBrowser/" + key, len(value))
-        index = 0
-        for v in value:
+        for index, v in enumerate(value):
             prefClass.settings.setArrayIndex(index)
             prefClass.settings.setValue("Keyword", v[0])
             prefClass.settings.setValue("Engine", v[1])
-            index += 1
         prefClass.settings.endArray()
     elif key == "DownloadManagerDownloads":
         # value is list of dicts containing the URL, save location, done flag,
         # page URL, date/time downloaded
         prefClass.settings.remove("Help/" + key)
         prefClass.settings.beginWriteArray("WebBrowser/" + key, len(value))
-        index = 0
-        for v in value:
+        for index, v in enumerate(value):
             prefClass.settings.setArrayIndex(index)
             prefClass.settings.setValue("URL", v["URL"])
             prefClass.settings.setValue("Location", v["Location"])
@@ -2912,19 +2905,16 @@
             prefClass.settings.setValue("PageURL", v["PageURL"])
             prefClass.settings.setValue(
                 "Downloaded", v["Downloaded"].toString("yyyy-MM-dd hh:mm:ss"))
-            index += 1
         prefClass.settings.endArray()
     elif key == "RssFeeds":
         # value is list of tuples of (URL, title, icon)
         prefClass.settings.remove("WebBrowser/" + key)
         prefClass.settings.beginWriteArray("WebBrowser/" + key, len(value))
-        index = 0
-        for v in value:
+        for index, v in enumerate(value):
             prefClass.settings.setArrayIndex(index)
             prefClass.settings.setValue("URL", v[0])
             prefClass.settings.setValue("Title", v[1])
             prefClass.settings.setValue("Icon", v[2])
-            index += 1
         prefClass.settings.endArray()
     elif key in ["SyncFtpPassword", "SyncEncryptionKey"]:
         from Utilities.crypto import pwConvert
--- a/eric6/Project/Project.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Project/Project.py	Sun Apr 11 12:38:16 2021 +0200
@@ -4559,8 +4559,7 @@
         
         self.recentMenu.clear()
         
-        idx = 1
-        for rp in self.recent:
+        for idx, rp in enumerate(self.recent, start=1):
             if idx < 10:
                 formatStr = '&{0:d}. {1}'
             else:
@@ -4571,7 +4570,6 @@
                     Utilities.compactPath(rp, self.ui.maxMenuFilePathLen)))
             act.setData(rp)
             act.setEnabled(QFileInfo(rp).exists())
-            idx += 1
         
         self.recentMenu.addSeparator()
         self.recentMenu.addAction(self.tr('&Clear'), self.clearRecent)
@@ -5403,9 +5401,8 @@
             0, len(selectedLists), self.tr("%v/%m Archives"))
         progress.setMinimumDuration(0)
         progress.setWindowTitle(self.tr("Create Plugin Archives"))
-        count = 0
         errors = 0
-        for pkglist in selectedLists:
+        for count, pkglist in enumerate(selectedLists):
             progress.setValue(count)
             if progress.wasCanceled():
                 break
@@ -5422,7 +5419,6 @@
                         """<p>Reason: {1}</p>""").format(
                         os.path.basename(pkglist), str(why)))
                 errors += 1
-                count += 1
                 continue
             
             lines = names.splitlines()
@@ -5451,7 +5447,6 @@
                                 """'; initial_list' line of the header."""
                                 """</p>""").format(os.path.basename(pkglist)))
                         errors += 1
-                        count += 1
                         listOK = False
                         break
                 elif line.strip():
@@ -5478,7 +5473,6 @@
                         """ could not be created.</p>"""
                         """<p>Reason: {1}</p>""").format(archive, str(why)))
                 errors += 1
-                count += 1
                 continue
             
             for name in names:
@@ -5519,8 +5513,6 @@
             
             if archive not in self.pdata["OTHERS"]:
                 self.appendFile(archive)
-            
-            count += 1
         
         progress.setValue(len(selectedLists))
         
--- a/eric6/Project/ProjectFormsBrowser.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Project/ProjectFormsBrowser.py	Sun Apr 11 12:38:16 2021 +0200
@@ -932,10 +932,9 @@
             progress.setModal(True)
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Forms"))
-            i = 0
             
-            for fn in self.project.pdata["FORMS"]:
-                progress.setValue(i)
+            for prog, fn in enumerate(self.project.pdata["FORMS"]):
+                progress.setValue(prog)
                 if progress.wasCanceled():
                     break
                 
@@ -947,8 +946,6 @@
                         QApplication.processEvents()
                 else:
                     break
-                i += 1
-                
             progress.setValue(numForms)
         
     def __compileSelectedForms(self):
@@ -970,10 +967,9 @@
             progress.setModal(True)
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Forms"))
-            i = 0
             
-            for fn in files:
-                progress.setValue(i)
+            for prog, fn in enumerate(files):
+                progress.setValue(prog)
                 if progress.wasCanceled():
                     break
                 
@@ -985,8 +981,6 @@
                         QApplication.processEvents()
                 else:
                     break
-                i += 1
-                
             progress.setValue(numForms)
         
     def compileChangedForms(self):
@@ -1007,13 +1001,12 @@
                 self.tr("Abort"), 0, 100, self.tr("%v/%m Forms"))
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Forms"))
-            i = 0
             
             # get list of changed forms
             changedForms = []
             progress.setMaximum(len(self.project.pdata["FORMS"]))
-            for fn in self.project.pdata["FORMS"]:
-                progress.setValue(i)
+            for prog, fn in enumerate(self.project.pdata["FORMS"]):
+                progress.setValue(prog)
                 QApplication.processEvents()
                 
                 ifn = os.path.join(self.project.ppath, fn)
@@ -1027,19 +1020,17 @@
                     os.stat(ifn).st_mtime > os.stat(ofn).st_mtime
                 ):
                     changedForms.append(fn)
-                i += 1
-            progress.setValue(i)
+            progress.setValue(len(self.project.pdata["FORMS"]))
             QApplication.processEvents()
             
             if changedForms:
                 progress.setLabelText(
                     self.tr("Compiling changed forms..."))
                 progress.setMaximum(len(changedForms))
-                i = 0
-                progress.setValue(i)
+                progress.setValue(prog)
                 QApplication.processEvents()
-                for fn in changedForms:
-                    progress.setValue(i)
+                for prog, fn in enumerate(changedForms):
+                    progress.setValue(prog)
                     if progress.wasCanceled():
                         break
                     
@@ -1051,7 +1042,6 @@
                             QApplication.processEvents()
                     else:
                         break
-                    i += 1
                 progress.setValue(len(changedForms))
                 QApplication.processEvents()
         
--- a/eric6/Project/ProjectInterfacesBrowser.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Project/ProjectInterfacesBrowser.py	Sun Apr 11 12:38:16 2021 +0200
@@ -616,10 +616,9 @@
             progress.setModal(True)
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Interfaces"))
-            i = 0
             
-            for fn in self.project.pdata["INTERFACES"]:
-                progress.setValue(i)
+            for prog, fn in enumerate(self.project.pdata["INTERFACES"]):
+                progress.setValue(prog)
                 if progress.wasCanceled():
                     break
                 proc = self.__compileIDL(fn, True, progress)
@@ -630,8 +629,6 @@
                         QApplication.processEvents()
                 else:
                     break
-                i += 1
-            
             progress.setValue(numIDLs)
         
     def __compileSelectedInterfaces(self):
@@ -651,10 +648,9 @@
             progress.setModal(True)
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Interfaces"))
-            i = 0
             
-            for fn in files:
-                progress.setValue(i)
+            for prog, fn in enumerate(files):
+                progress.setValue(prog)
                 if progress.wasCanceled():
                     break
                 proc = self.__compileIDL(fn, True, progress)
@@ -665,8 +661,6 @@
                         QApplication.processEvents()
                 else:
                     break
-                i += 1
-                
             progress.setValue(numIDLs)
     
     def __configureIdlCompiler(self):
--- a/eric6/Project/ProjectProtocolsBrowser.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Project/ProjectProtocolsBrowser.py	Sun Apr 11 12:38:16 2021 +0200
@@ -661,10 +661,9 @@
             progress.setModal(True)
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Protocols"))
-            i = 0
             
-            for fn in self.project.pdata["PROTOCOLS"]:
-                progress.setValue(i)
+            for prog, fn in enumerate(self.project.pdata["PROTOCOLS"]):
+                progress.setValue(prog)
                 if progress.wasCanceled():
                     break
                 proc = self.__compileProto(fn, True, progress, grpc=grpc)
@@ -675,8 +674,6 @@
                         QApplication.processEvents()
                 else:
                     break
-                i += 1
-            
             progress.setValue(numProtos)
         
     def __compileSelectedProtocols(self, grpc=False):
@@ -699,10 +696,9 @@
             progress.setModal(True)
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Protocols"))
-            i = 0
             
-            for fn in files:
-                progress.setValue(i)
+            for prog, fn in enumerate(files):
+                progress.setValue(prog)
                 if progress.wasCanceled():
                     break
                 proc = self.__compileProto(fn, True, progress, grpc=grpc)
@@ -713,8 +709,6 @@
                         QApplication.processEvents()
                 else:
                     break
-                i += 1
-                
             progress.setValue(numProtos)
         
     def __configureProtobuf(self):
--- a/eric6/Project/ProjectResourcesBrowser.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Project/ProjectResourcesBrowser.py	Sun Apr 11 12:38:16 2021 +0200
@@ -750,10 +750,9 @@
             progress.setModal(True)
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Resources"))
-            i = 0
             
-            for fn in self.project.pdata["RESOURCES"]:
-                progress.setValue(i)
+            for prog, fn in enumerate(self.project.pdata["RESOURCES"]):
+                progress.setValue(prog)
                 if progress.wasCanceled():
                     break
                 proc = self.__compileQRC(fn, True, progress)
@@ -764,8 +763,6 @@
                         QApplication.processEvents()
                 else:
                     break
-                i += 1
-                
             progress.setValue(numResources)
         
     def __compileSelectedResources(self):
@@ -787,10 +784,9 @@
             progress.setModal(True)
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Resources"))
-            i = 0
             
-            for fn in files:
-                progress.setValue(i)
+            for prog, fn in enumerate(files):
+                progress.setValue(prog)
                 if progress.wasCanceled():
                     break
                 if not fn.endswith('.ui.h'):
@@ -802,8 +798,6 @@
                             QApplication.processEvents()
                     else:
                         break
-                i += 1
-                
             progress.setValue(numResources)
         
     def __checkResourcesNewer(self, filename, mtime):
@@ -859,13 +853,12 @@
                 self.tr("Abort"), 0, 100, self.tr("%v/%m Resources"))
             progress.setMinimumDuration(0)
             progress.setWindowTitle(self.tr("Resources"))
-            i = 0
             
             # get list of changed resources
             changedResources = []
             progress.setMaximum(len(self.project.pdata["RESOURCES"]))
-            for fn in self.project.pdata["RESOURCES"]:
-                progress.setValue(i)
+            for prog, fn in enumerate(self.project.pdata["RESOURCES"]):
+                progress.setValue(prog)
                 QApplication.processEvents()
                 ifn = os.path.join(self.project.ppath, fn)
                 if self.project.getProjectLanguage() == "Python3":
@@ -885,19 +878,17 @@
                     changedResources.append(fn)
                 elif self.__checkResourcesNewer(ifn, os.stat(ofn).st_mtime):
                     changedResources.append(fn)
-                i += 1
-            progress.setValue(i)
+            progress.setValue(len(self.project.pdata["RESOURCES"]))
             QApplication.processEvents()
             
             if changedResources:
                 progress.setLabelText(
                     self.tr("Compiling changed resources..."))
                 progress.setMaximum(len(changedResources))
-                i = 0
-                progress.setValue(i)
+                progress.setValue(0)
                 QApplication.processEvents()
-                for fn in changedResources:
-                    progress.setValue(i)
+                for prog, fn in enumerate(changedResources):
+                    progress.setValue(prog)
                     if progress.wasCanceled():
                         break
                     proc = self.__compileQRC(fn, True, progress)
@@ -908,7 +899,6 @@
                             QApplication.processEvents()
                     else:
                         break
-                    i += 1
                 progress.setValue(len(changedResources))
                 QApplication.processEvents()
         
--- a/eric6/QScintilla/Editor.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/QScintilla/Editor.py	Sun Apr 11 12:38:16 2021 +0200
@@ -2849,9 +2849,7 @@
         self.__hasTaskMarkers = False
         
         # now search tasks and record them
-        lineIndex = -1
-        for line in txtList:
-            lineIndex += 1
+        for lineIndex, line in enumerate(txtList):
             shouldBreak = False
             
             if line.endswith("__NO-TASK__"):
--- a/eric6/QScintilla/EditorAssembly.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/QScintilla/EditorAssembly.py	Sun Apr 11 12:38:16 2021 +0200
@@ -466,3 +466,6 @@
             self.__editor.getLanguage())
         
         self.__sourceOutline.setVisible(supported)
+
+#
+# eflag: noqa = Y113
--- a/eric6/QScintilla/Lexers/SubstyledLexer.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/QScintilla/Lexers/SubstyledLexer.py	Sun Apr 11 12:38:16 2021 +0200
@@ -187,9 +187,9 @@
                 if subStyleStart < 0:
                     continue
                 
-                subStyleIndex = -1
-                for subStyleKey in sorted(subStylesData.keys()):
-                    subStyleIndex += 1
+                for subStyleIndex, subStyleKey in enumerate(
+                    sorted(subStylesData.keys())
+                ):
                     styleNo = subStyleStart + subStyleIndex
                     subStyle = subStylesData[subStyleKey]
                     # set the words
@@ -266,9 +266,9 @@
             key = "Scintilla/{0}/style{1}/SubStyleLength".format(
                 self.language(), baseStyle)
             settings.setValue(key, len(self.__subStyles[baseStyle]))
-            subStyleIndex = -1
-            for subStyle in sorted(self.__subStyles[baseStyle].keys()):
-                subStyleIndex += 1
+            for subStyleIndex, subStyle in enumerate(
+                sorted(self.__subStyles[baseStyle].keys())
+            ):
                 substyleKey = "Scintilla/{0}/style{1}/substyle{2}/".format(
                     self.language(), baseStyle, subStyleIndex)
                 subStyleData = self.__subStyles[baseStyle][subStyle]
--- a/eric6/QScintilla/ShellWindow.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/QScintilla/ShellWindow.py	Sun Apr 11 12:38:16 2021 +0200
@@ -70,7 +70,8 @@
         
         # initialize the debug server and shell widgets
         self.__debugServer = DebugServer(originalPathString,
-                                         preventPassiveDebugging=True)
+                                         preventPassiveDebugging=True,
+                                         parent=self)
         self.__shell = Shell(self.__debugServer, self, None, True, self)
         self.__searchWidget = SearchWidget(self.__shell, self, showLine=True)
         
--- a/eric6/Tasks/TaskViewer.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Tasks/TaskViewer.py	Sun Apr 11 12:38:16 2021 +0200
@@ -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))
     
@@ -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__"):
--- a/eric6/Templates/TemplateMultipleVariablesDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Templates/TemplateMultipleVariablesDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -53,8 +53,7 @@
 
         # populate the scrollarea with labels and text edits
         self.variablesEntries = {}
-        row = 0
-        for var in variables:
+        for row, var in enumerate(variables):
             label = QLabel("{0}:".format(var), self.top)
             self.grid.addWidget(label, row, 0,
                                 Qt.Alignment(Qt.AlignmentFlag.AlignTop))
@@ -69,11 +68,10 @@
                 t = QLineEdit(self.top)
             self.grid.addWidget(t, row, 1)
             self.variablesEntries[var] = t
-            row += 1
         # add a spacer to make the entries aligned at the top
         spacer = QSpacerItem(
             20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
-        self.grid.addItem(spacer, row, 1)
+        self.grid.addItem(spacer, self.grid.rowCount(), 1)
         self.variablesEntries[variables[0]].setFocus()
         self.top.adjustSize()
 
--- a/eric6/Templates/TemplateViewer.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Templates/TemplateViewer.py	Sun Apr 11 12:38:16 2021 +0200
@@ -334,13 +334,11 @@
                     indent = line.replace(line.lstrip(), "")
                     prefix = line[:ind]
                     postfix = line[ind + len(var):]
-                    count = 0
-                    for v in val.splitlines():
+                    for count, v in enumerate(val.splitlines()):
                         if count:
                             t = "{0}{1}{2}{3}".format(t, os.linesep, indent, v)
                         else:
                             t = "{0}{1}{2}{3}".format(t, os.linesep, prefix, v)
-                        count += 1
                     t = "{0}{1}".format(t, postfix)
                 else:
                     t = "{0}{1}{2}".format(t, os.linesep, line)
--- a/eric6/Tools/TrayStarter.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Tools/TrayStarter.py	Sun Apr 11 12:38:16 2021 +0200
@@ -427,8 +427,7 @@
         
         self.recentProjectsMenu.clear()
         
-        idx = 1
-        for rp in self.recentProjects:
+        for idx, rp in enumerate(self.recentProjects, start=1):
             if idx < 10:
                 formatStr = '&{0:d}. {1}'
             else:
@@ -437,7 +436,6 @@
                 formatStr.format(
                     idx, Utilities.compactPath(rp, self.maxMenuFilePathLen)))
             act.setData(rp)
-            idx += 1
     
     def __showRecentMultiProjectsMenu(self):
         """
@@ -449,8 +447,7 @@
         
         self.recentMultiProjectsMenu.clear()
         
-        idx = 1
-        for rmp in self.recentMultiProjects:
+        for idx, rmp in enumerate(self.recentMultiProjects, start=1):
             if idx < 10:
                 formatStr = '&{0:d}. {1}'
             else:
@@ -459,7 +456,6 @@
                 formatStr.format(
                     idx, Utilities.compactPath(rmp, self.maxMenuFilePathLen)))
             act.setData(rmp)
-            idx += 1
     
     def __showRecentFilesMenu(self):
         """
@@ -471,8 +467,7 @@
         
         self.recentFilesMenu.clear()
         
-        idx = 1
-        for rf in self.recentFiles:
+        for idx, rf in enumerate(self.recentFiles, start=1):
             if idx < 10:
                 formatStr = '&{0:d}. {1}'
             else:
@@ -481,7 +476,6 @@
                 formatStr.format(
                     idx, Utilities.compactPath(rf, self.maxMenuFilePathLen)))
             act.setData(rf)
-            idx += 1
     
     def __openRecent(self, act):
         """
--- a/eric6/UI/CompareDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/UI/CompareDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -307,11 +307,12 @@
         deleted = 0
         changed = 0
         
-        paras = 1
         self.diffParas = []
         self.currentDiffPos = -1
         oldOpcode = ''
-        for opcode, ln1, l1, ln2, l2 in sbsdiff(lines1, lines2):
+        for paras, (opcode, ln1, l1, ln2, l2) in enumerate(
+            sbsdiff(lines1, lines2), start=1
+        ):
             if opcode in 'idr':
                 if oldOpcode != opcode:
                     oldOpcode = opcode
@@ -344,7 +345,6 @@
                 format2 = self.cNormalFormat
             self.__appendText(self.contents_1, ln1, l1, format1, opcode == 'r')
             self.__appendText(self.contents_2, ln2, l2, format2, opcode == 'r')
-            paras += 1
             if not (paras % self.updateInterval):
                 QApplication.processEvents()
         
--- a/eric6/UI/DiffDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/UI/DiffDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -229,15 +229,14 @@
         @param fromfiledate modification time of the first file (string)
         @param tofiledate modification time of the second file (string)
         """
-        paras = 0
-        for line in unified_diff(a, b, fromfile, tofile,
-                                 fromfiledate, tofiledate):
+        for paras, line in enumerate(
+            unified_diff(a, b, fromfile, tofile, fromfiledate, tofiledate)
+        ):
             self.__appendText(line)
-            paras += 1
             if not (paras % self.updateInterval):
                 QApplication.processEvents()
             
-        if paras == 0:
+        if self.contents.toPlainText().strip() == "":
             self.__appendText(self.tr('There is no difference.'))
 
     def __generateContextDiff(self, a, b, fromfile, tofile,
@@ -252,15 +251,14 @@
         @param fromfiledate modification time of the first file (string)
         @param tofiledate modification time of the second file (string)
         """
-        paras = 0
-        for line in context_diff(a, b, fromfile, tofile,
-                                 fromfiledate, tofiledate):
+        for paras, line in enumerate(
+            context_diff(a, b, fromfile, tofile, fromfiledate, tofiledate)
+        ):
             self.__appendText(line)
-            paras += 1
             if not (paras % self.updateInterval):
                 QApplication.processEvents()
             
-        if paras == 0:
+        if self.contents.toPlainText().strip() == "":
             self.__appendText(self.tr('There is no difference.'))
 
     def __fileChanged(self):
--- a/eric6/UI/FindFileDialog.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/UI/FindFileDialog.py	Sun Apr 11 12:38:16 2021 +0200
@@ -502,11 +502,10 @@
         # now go through all the files
         self.__populating = True
         self.findList.setUpdatesEnabled(False)
-        progress = 0
         breakSearch = False
         occurrences = 0
         fileOccurrences = 0
-        for file in files:
+        for progress, file in enumerate(files, start=1):
             self.__lastFileItem = None
             found = False
             if self.__cancelSearch or breakSearch:
@@ -523,17 +522,14 @@
                 text, encoding, hashStr = Utilities.readEncodedFileWithHash(fn)
                 lines = text.splitlines(True)
             except (UnicodeError, OSError):
-                progress += 1
                 self.findProgress.setValue(progress)
                 continue
             
             # now perform the search and display the lines found
-            count = 0
-            for line in lines:
+            for count, line in enumerate(lines, start=1):
                 if self.__cancelSearch:
                     break
                 
-                count += 1
                 contains = search.search(line)
                 if contains:
                     occurrences += 1
@@ -566,7 +562,6 @@
             
             if found:
                 fileOccurrences += 1
-            progress += 1
             self.findProgress.setValue(progress)
         
         if not files:
@@ -678,7 +673,6 @@
         self.findProgress.setMaximum(self.findList.topLevelItemCount())
         self.findProgress.setValue(0)
         
-        progress = 0
         for index in range(self.findList.topLevelItemCount()):
             itm = self.findList.topLevelItem(index)
             if itm.checkState(0) in [Qt.CheckState.PartiallyChecked,
@@ -708,8 +702,7 @@
                             """ Skipping it.</p><p>Reason: {1}</p>""")
                         .format(fn, str(err))
                     )
-                    progress += 1
-                    self.findProgress.setValue(progress)
+                    self.findProgress.setValue(index)
                     continue
                 
                 # Check the original and the current hash. Skip the file,
@@ -724,8 +717,7 @@
                             """</p><p>Hash 1: {1}</p><p>Hash 2: {2}</p>""")
                         .format(fn, origHash, hashStr)
                     )
-                    progress += 1
-                    self.findProgress.setValue(progress)
+                    self.findProgress.setValue(index)
                     continue
                 
                 # replace the lines authorized by the user
@@ -750,8 +742,7 @@
                         .format(fn, str(err))
                     )
             
-            progress += 1
-            self.findProgress.setValue(progress)
+            self.findProgress.setValue(index)
         
         self.findProgressLabel.setPath("")
         
--- a/eric6/UI/UserInterface.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/UI/UserInterface.py	Sun Apr 11 12:38:16 2021 +0200
@@ -4238,9 +4238,10 @@
         self.__menus["user_tools"].addSeparator()
         
         # add the configurable entries
-        idx = 0
         try:
-            for tool in self.toolGroups[self.currentToolGroup][1]:
+            for idx, tool in enumerate(
+                self.toolGroups[self.currentToolGroup][1]
+            ):
                 if tool['menutext'] == '--':
                     self.__menus["user_tools"].addSeparator()
                 else:
@@ -4248,7 +4249,6 @@
                         UI.PixmapCache.getIcon(tool['icon']),
                         tool['menutext'])
                     act.setData(idx)
-                idx += 1
         except IndexError:
             # the current tool group might have been deleted
             act = self.__menus["user_tools"].addAction(
@@ -4263,15 +4263,13 @@
         
         # add the configurable tool groups
         if self.toolGroups:
-            idx = 0
-            for toolGroup in self.toolGroups:
+            for idx, toolGroup in enumerate(self.toolGroups):
                 act = self.toolGroupsMenu.addAction(toolGroup[0])
                 act.setData(idx)
                 if self.currentToolGroup == idx:
                     font = act.font()
                     font.setBold(True)
                     act.setFont(font)
-                idx += 1
         else:
             act = self.toolGroupsMenu.addAction(
                 self.tr("No User Tools Configured"))
--- a/eric6/Utilities/crypto/py3AES.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/Utilities/crypto/py3AES.py	Sun Apr 11 12:38:16 2021 +0200
@@ -249,7 +249,7 @@
                 expandedKey[currentSize] = (
                     expandedKey[currentSize - size] ^ t[m]
                 )
-                currentSize += 1
+                currentSize += 1        # __IGNORE_WARNING_Y113__
 
         return expandedKey
 
--- a/eric6/ViewManager/ViewManager.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/ViewManager/ViewManager.py	Sun Apr 11 12:38:16 2021 +0200
@@ -5162,8 +5162,7 @@
         
         self.recentMenu.clear()
         
-        idx = 1
-        for rs in self.recent:
+        for idx, rs in enumerate(self.recent, start=1):
             if idx < 10:
                 formatStr = '&{0:d}. {1}'
             else:
@@ -5174,7 +5173,6 @@
                     Utilities.compactPath(rs, self.ui.maxMenuFilePathLen)))
             act.setData(rs)
             act.setEnabled(QFileInfo(rs).exists())
-            idx += 1
         
         self.recentMenu.addSeparator()
         self.recentMenu.addAction(
--- a/eric6/WebBrowser/AdBlock/AdBlockTreeWidget.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/WebBrowser/AdBlock/AdBlockTreeWidget.py	Sun Apr 11 12:38:16 2021 +0200
@@ -95,15 +95,13 @@
             
             allRules = self.__subscription.allRules()
             
-            index = 0
-            for rule in allRules:
+            for index, rule in enumerate(allRules):
                 item = QTreeWidgetItem(self.__topItem)
                 item.setText(0, rule.filter())
                 item.setData(0, Qt.ItemDataRole.UserRole, index)
                 if self.__subscription.canEditRules():
                     item.setFlags(item.flags() | Qt.ItemFlag.ItemIsEditable)
                 self.__adjustItemFeatures(item, rule)
-                index += 1
             
             self.expandAll()
             self.showRule(None)
--- a/eric6/WebBrowser/History/HistoryMenu.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/WebBrowser/History/HistoryMenu.py	Sun Apr 11 12:38:16 2021 +0200
@@ -433,8 +433,9 @@
         
         import WebBrowser.WebBrowserWindow
         self.__closedTabsMenu.clear()
-        index = 0
-        for tab in self.__tabWidget.closedTabsManager().allClosedTabs():
+        for index, tab in enumerate(
+            self.__tabWidget.closedTabsManager().allClosedTabs()
+        ):
             title = fm.elidedText(tab.title, Qt.TextElideMode.ElideRight,
                                   maxWidth)
             act = self.__closedTabsMenu.addAction(
@@ -443,7 +444,6 @@
             act.setData(index)
             act.triggered.connect(
                 functools.partial(self.__tabWidget.restoreClosedTab, act))
-            index += 1
         self.__closedTabsMenu.addSeparator()
         self.__closedTabsMenu.addAction(
             self.tr("Restore All Closed Tabs"),
--- a/eric6/WebBrowser/Navigation/NavigationBar.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/WebBrowser/Navigation/NavigationBar.py	Sun Apr 11 12:38:16 2021 +0200
@@ -233,22 +233,16 @@
         """
         self.__backMenu.clear()
         history = self.__mw.currentBrowser().history()
-        historyCount = history.count()
-        backItems = history.backItems(historyCount)
+        backItems = history.backItems(20)
+        # show max. 20 items
         
-        count = 0
-        for index in range(len(backItems) - 1, -1, -1):
-            item = backItems[index]
+        for item in reversed(backItems):
             act = QAction(self)
             act.setData(item)
             icon = WebBrowserWindow.icon(item.url())
             act.setIcon(icon)
             act.setText(item.title())
             self.__backMenu.addAction(act)
-            
-            count += 1
-            if count == 20:
-                break
         
         self.__backMenu.addSeparator()
         self.__backMenu.addAction(self.tr("Clear History"),
@@ -260,22 +254,16 @@
         """
         self.__forwardMenu.clear()
         history = self.__mw.currentBrowser().history()
-        historyCount = history.count()
-        forwardItems = history.forwardItems(historyCount)
+        forwardItems = history.forwardItems(20)
+        # show max. 20 items
         
-        count = 0
-        for index in range(len(forwardItems)):
-            item = forwardItems[index]
+        for item in forwardItems:
             act = QAction(self)
             act.setData(item)
             icon = WebBrowserWindow.icon(item.url())
             act.setIcon(icon)
             act.setText(item.title())
             self.__forwardMenu.addAction(act)
-            
-            count += 1
-            if count == 20:
-                break
         
         self.__forwardMenu.addSeparator()
         self.__forwardMenu.addAction(self.tr("Clear History"),
--- a/eric6/WebBrowser/Passwords/PasswordManager.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/WebBrowser/Passwords/PasswordManager.py	Sun Apr 11 12:38:16 2021 +0200
@@ -417,3 +417,6 @@
         progress.setValue(len(self.__logins) + len(self.__loginForms))
         QCoreApplication.processEvents()
         self.changed.emit()
+
+#
+# eflag: noqa = Y113
--- 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)
--- a/eric6/WebBrowser/WebBrowserTabWidget.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/WebBrowser/WebBrowserTabWidget.py	Sun Apr 11 12:38:16 2021 +0200
@@ -1152,15 +1152,13 @@
             maxWidth = fm.width('m') * 40
         
         self.__closedTabsMenu.clear()
-        index = 0
-        for tab in self.__closedTabsManager.allClosedTabs():
+        for index, tab in enumerate(self.__closedTabsManager.allClosedTabs()):
             title = fm.elidedText(tab.title, Qt.TextElideMode.ElideRight,
                                   maxWidth)
             act = self.__closedTabsMenu.addAction(
                 self.__mainWindow.icon(tab.url), title)
             act.setData(index)
             act.triggered.connect(lambda: self.restoreClosedTab(act))
-            index += 1
         self.__closedTabsMenu.addSeparator()
         self.__closedTabsMenu.addAction(
             self.tr("Restore All Closed Tabs"), self.restoreAllClosedTabs)

eric ide

mercurial