Fixed some code style issues.

Thu, 19 Sep 2019 19:39:04 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 19 Sep 2019 19:39:04 +0200
changeset 7249
0bf517e60f54
parent 7248
60b48ab891fa
child 7250
d8bdc55aee1a

Fixed some code style issues.

eric6/CondaInterface/__init__.py file | annotate | diff | comparison | revisions
eric6/DebugClients/Python/BreakpointWatch.py file | annotate | diff | comparison | revisions
eric6/DebugClients/Python/DebugClientBase.py file | annotate | diff | comparison | revisions
eric6/Debugger/DebugServer.py file | annotate | diff | comparison | revisions
eric6/Debugger/DebuggerInterfacePython.py file | annotate | diff | comparison | revisions
eric6/E5Graphics/E5ArrowItem.py file | annotate | diff | comparison | revisions
eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py file | annotate | diff | comparison | revisions
eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py file | annotate | diff | comparison | revisions
eric6/Plugins/CheckerPlugins/CodeStyleChecker/NamingStyleChecker.py file | annotate | diff | comparison | revisions
eric6/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditConfigDialog.py file | annotate | diff | comparison | revisions
eric6/QScintilla/Exporters/ExporterPDF.py file | annotate | diff | comparison | revisions
eric6/Snapshot/SnapshotWaylandGrabber.py file | annotate | diff | comparison | revisions
eric6/Tasks/TaskFilter.py file | annotate | diff | comparison | revisions
eric6/UI/BrowserModel.py file | annotate | diff | comparison | revisions
eric6/Utilities/BackgroundClient.py file | annotate | diff | comparison | revisions
eric6/Utilities/ClassBrowsers/pyclbr.py file | annotate | diff | comparison | revisions
eric6/Utilities/ModuleParser.py file | annotate | diff | comparison | revisions
eric6/Utilities/binplistlib.py file | annotate | diff | comparison | revisions
eric6/VCS/StatusMonitorThread.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/FlashCookieManager/FlashCookieReader.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/FlashCookieManager/FlashCookieUtilities.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/Network/EricSchemeHandler.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/Network/ProtocolHandlerManager.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/OpenSearch/OpenSearchEngineModel.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/Passwords/PasswordModel.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/WebBrowserPage.py file | annotate | diff | comparison | revisions
eric6/WebBrowser/WebBrowserView.py file | annotate | diff | comparison | revisions
--- a/eric6/CondaInterface/__init__.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/CondaInterface/__init__.py	Thu Sep 19 19:39:04 2019 +0200
@@ -14,7 +14,7 @@
 
 import Preferences
 
-__CondaVersion = tuple()
+__CondaVersion = ()
 __CondaVersionStr = ""
 __CondaRootPrefix = ""
 __CondaUserConfig = ""
--- a/eric6/DebugClients/Python/BreakpointWatch.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/DebugClients/Python/BreakpointWatch.py	Thu Sep 19 19:39:04 2019 +0200
@@ -169,8 +169,6 @@
                         # continue
                     else:
                         return (b, True)
-                # else:
-                #   continue
             except Exception:
                 # if eval fails, most conservative
                 # thing is to stop on breakpoint
--- a/eric6/DebugClients/Python/DebugClientBase.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/DebugClients/Python/DebugClientBase.py	Thu Sep 19 19:39:04 2019 +0200
@@ -651,8 +651,8 @@
                                     _locals = \
                                         self.currentThread.getFrameLocals(
                                             self.framenr)
-                            # reset sys.stdout to our redirector
-                            # (unconditionally)
+                            ## reset sys.stdout to our redirector
+                            ## (unconditionally)
                             if "sys" in _globals:
                                 __stdout = _globals["sys"].stdout
                                 _globals["sys"].stdout = self.writestream
--- a/eric6/Debugger/DebugServer.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Debugger/DebugServer.py	Thu Sep 19 19:39:04 2019 +0200
@@ -219,7 +219,7 @@
         # Change clientType if dependent interpreter does not exist anymore
         # (maybe deinstalled,...)
         elif self.clientType == 'Python2' and Preferences.getDebugger(
-                "Python2VirtualEnv") == '' and sys.version_info[0] == 3:
+                "Python2VirtualEnv") == '' and sys.version_info[0] >= 3:
             self.clientType = 'Python3'
         elif self.clientType == 'Python3' and Preferences.getDebugger(
                 "Python3VirtualEnv") == '' and sys.version_info[0] == 2:
@@ -422,7 +422,7 @@
         if language in self.__debuggerInterfaceRegistry:
             return tuple(self.__debuggerInterfaceRegistry[language][1])
         else:
-            return tuple()
+            return ()
         
     def __createDebuggerInterface(self, clientType=None):
         """
--- a/eric6/Debugger/DebuggerInterfacePython.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Debugger/DebuggerInterfacePython.py	Thu Sep 19 19:39:04 2019 +0200
@@ -1367,7 +1367,7 @@
         )
     
     if py3Exts and (Preferences.getDebugger("Python3VirtualEnv") or
-                    sys.version_info[0] == 3):
+                    sys.version_info[0] >= 3):
         registryData.append(
             ("Python3", ClientDefaultCapabilities, py3Exts,
                 createDebuggerInterfacePython3)
--- a/eric6/E5Graphics/E5ArrowItem.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/E5Graphics/E5ArrowItem.py	Thu Sep 19 19:39:04 2019 +0200
@@ -18,7 +18,7 @@
 WideArrow = 2
 
 ArrowheadAngleFactor = 0.26179938779914941
-# 0.5 * math.atan(math.sqrt(3.0) / 3.0)
+# That is: 0.5 * math.atan(math.sqrt(3.0) / 3.0)
 
 
 class E5ArrowItem(QAbstractGraphicsShapeItem):
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py	Thu Sep 19 19:39:04 2019 +0200
@@ -1323,9 +1323,8 @@
             newText = text[:col].rstrip() + text[col:].lstrip()
         
         # There could be an escaped newline
-        #
-        #     def foo(a=\
-        #             1)
+        # like 'def foo(a=\
+        #               1)'
         if newText.endswith(('=\\\n', '=\\\r\n', '=\\\r')):
             self.__source[line] = newText.rstrip("\n\r \t\\")
             self.__source[line + 1] = self.__source[line + 1].lstrip()
@@ -2115,7 +2114,7 @@
         nrows = 1 + self.tokens[-1][2][0] - first_row
 
         # here are the return values
-        valid_indents = [list()] * nrows
+        valid_indents = [[]] * nrows
         indent_level = self.tokens[0][2][1]
         valid_indents[0].append(indent_level)
 
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py	Thu Sep 19 19:39:04 2019 +0200
@@ -927,7 +927,7 @@
         """
         Private method to check use of naive datetime functions.
         """
-        if sys.version_info[0] == 3:
+        if sys.version_info[0] >= 3:
             # this check is only performed for Python 3
             
             # step 1: generate an augmented node tree containing parent info
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/NamingStyleChecker.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/NamingStyleChecker.py	Thu Sep 19 19:39:04 2019 +0200
@@ -131,8 +131,8 @@
         
         @param classNode AST tree node to tag
         """
-        # try to find all 'old style decorators' like
-        # m = staticmethod(m)
+        # try to find all 'old style decorators'
+        # like m = staticmethod(m)
         lateDecoration = {}
         for node in ast.iter_child_nodes(classNode):
             if not (isinstance(node, ast.Assign) and
@@ -188,7 +188,7 @@
         @param node AST node to extract arguments names from
         @return list of argument names (list of string)
         """
-        if sys.version_info[0] == 3:
+        if sys.version_info[0] >= 3:
             posArgs = [arg.arg for arg in node.args.args]
             kwOnly = [arg.arg for arg in node.args.kwonlyargs]
             return posArgs + kwOnly
--- a/eric6/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py	Thu Sep 19 19:39:04 2019 +0200
@@ -331,19 +331,19 @@
         @param tabsize The length of a tab stop. (integer)
         @return indentation level (integer)
         """
-        # count, il = self.norm
-        # for i in range(len(count)):
-        #    if count[i]:
-        #        il = il + (i/tabsize + 1)*tabsize * count[i]
-        # return il
+        ## count, il = self.norm
+        ## for i in range(len(count)):
+        ##    if count[i]:
+        ##        il = il + (i/tabsize + 1)*tabsize * count[i]
+        ## return il
 
-        # quicker:
-        # il = trailing + sum (i/ts + 1)*ts*count[i] =
-        # trailing + ts * sum (i/ts + 1)*count[i] =
-        # trailing + ts * sum i/ts*count[i] + count[i] =
-        # trailing + ts * [(sum i/ts*count[i]) + (sum count[i])] =
-        # trailing + ts * [(sum i/ts*count[i]) + num_tabs]
-        # and note that i/ts*count[i] is 0 when i < ts
+        ## quicker:
+        ## il = trailing + sum (i/ts + 1)*ts*count[i] =
+        ## trailing + ts * sum (i/ts + 1)*count[i] =
+        ## trailing + ts * sum i/ts*count[i] + count[i] =
+        ## trailing + ts * [(sum i/ts*count[i]) + (sum count[i])] =
+        ## trailing + ts * [(sum i/ts*count[i]) + num_tabs]
+        ## and note that i/ts*count[i] is 0 when i < ts
 
         count, trailing = self.norm
         il = 0
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditConfigDialog.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditConfigDialog.py	Thu Sep 19 19:39:04 2019 +0200
@@ -204,7 +204,6 @@
         elif self.outgoingButton.isChecked():
             return "--outgoing"
         else:
-            # self.revisionButton.isChecked()
             if self.numberButton.isChecked():
                 return "rev({0})".format(self.numberSpinBox.value())
             elif self.idButton.isChecked():
--- a/eric6/QScintilla/Exporters/ExporterPDF.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/QScintilla/Exporters/ExporterPDF.py	Thu Sep 19 19:39:04 2019 +0200
@@ -39,7 +39,7 @@
 PDFfontWidths = [600, 0, 0]
 
 PDFpageSizes = {
-    # name   : (height, width)
+    ## name   : (height, width)
     "Letter": (792, 612),
     "A4": (842, 595),
 }
--- a/eric6/Snapshot/SnapshotWaylandGrabber.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Snapshot/SnapshotWaylandGrabber.py	Thu Sep 19 19:39:04 2019 +0200
@@ -70,7 +70,7 @@
                 SnapshotModes.Rectangle,
             )
         else:
-            modes = tuple()
+            modes = ()
         
         return modes
     
--- a/eric6/Tasks/TaskFilter.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Tasks/TaskFilter.py	Thu Sep 19 19:39:04 2019 +0200
@@ -29,13 +29,13 @@
         # task type
         
         self.scopeFilter = None
-        # global (False) or project (True)
+        ## global (False) or project (True)
         
         self.statusFilter = None
-        # uncompleted (False) or completed (True)
+        ## uncompleted (False) or completed (True)
         
         self.prioritiesFilter = None
-        # list of priorities [0 (high), 1 (normal), 2 (low)]
+        ## list of priorities [0 (high), 1 (normal), 2 (low)]
     
     def setActive(self, enabled):
         """
--- a/eric6/UI/BrowserModel.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/UI/BrowserModel.py	Thu Sep 19 19:39:04 2019 +0200
@@ -1406,10 +1406,10 @@
             if self._classObject.annotation:
                 self.itemData[0] = "{0} {1}".format(
                     self.itemData[0], self._classObject.annotation)
-            # if no defaults are wanted
-            # ....format(name,
-            #            ", ".join([e.split('=')[0].strip() \
-            #                       for e in self._classObject.parameters]))
+            ## if no defaults are wanted
+            ## ....format(name,
+            ##            ", ".join([e.split('=')[0].strip() \
+            ##                       for e in self._classObject.parameters]))
         elif self.ismodule:
             self.icon = UI.PixmapCache.getIcon("module.png")
         elif self.isenum:
--- a/eric6/Utilities/BackgroundClient.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Utilities/BackgroundClient.py	Thu Sep 19 19:39:04 2019 +0200
@@ -80,7 +80,7 @@
         @param data return value(s) (any basic datatype)
         """
         packedData = json.dumps([fx, fn, data])
-        if sys.version_info[0] == 3:
+        if sys.version_info[0] >= 3:
             packedData = bytes(packedData, 'utf-8')
         header = struct.pack(
             b'!II', len(packedData), adler32(packedData) & 0xffffffff)
@@ -154,7 +154,7 @@
                 
                 assert adler32(packedData) & 0xffffffff == datahash, \
                     'Hashes not equal'
-                if sys.version_info[0] == 3:
+                if sys.version_info[0] >= 3:
                     packedData = packedData.decode('utf-8')
                 
                 fx, fn, data = json.loads(packedData)
--- a/eric6/Utilities/ClassBrowsers/pyclbr.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Utilities/ClassBrowsers/pyclbr.py	Thu Sep 19 19:39:04 2019 +0200
@@ -609,7 +609,7 @@
             dictionary['__all__'] = pubs
         
         elif m.start("Import") >= 0:
-            # import module
+            ## import module
             names = [n.strip() for n in
                      "".join(m.group("ImportList").splitlines())
                      .replace("\\", "").split(',')]
@@ -621,7 +621,7 @@
                 dictionary["@@Import@@"].addImport(name, [], lineno)
         
         elif m.start("ImportFrom") >= 0:
-            # from module import stuff
+            ## from module import stuff
             mod = m.group("ImportFromPath")
             namesLines = (m.group("ImportFromList")
                           .replace("(", "").replace(")", "")
--- a/eric6/Utilities/ModuleParser.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Utilities/ModuleParser.py	Thu Sep 19 19:39:04 2019 +0200
@@ -780,7 +780,7 @@
                             break
 
             elif m.start("Import") >= 0:
-                # import module
+                ## import module
                 names = [n.strip() for n in
                          "".join(m.group("ImportList").splitlines())
                          .replace("\\", "").split(',')]
@@ -789,7 +789,7 @@
                      if name not in self.imports])
             
             elif m.start("ImportFrom") >= 0:
-                # from module import stuff
+                ## from module import stuff
                 mod = m.group("ImportFromPath")
                 namesLines = (m.group("ImportFromList")
                               .replace("(", "").replace(")", "")
--- a/eric6/Utilities/binplistlib.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/Utilities/binplistlib.py	Thu Sep 19 19:39:04 2019 +0200
@@ -347,7 +347,6 @@
         
         def proc_extra(extra):
             if extra == 0b1111:
-                #self.currentOffset += 1
                 extra = self.readObject()
             return extra
         
--- a/eric6/VCS/StatusMonitorThread.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/VCS/StatusMonitorThread.py	Thu Sep 19 19:39:04 2019 +0200
@@ -203,7 +203,7 @@
         """
         raise RuntimeError('Not implemented')
         
-        return tuple()
+        return ()
     
     def _getInfo(self):
         """
--- a/eric6/WebBrowser/FlashCookieManager/FlashCookieReader.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/WebBrowser/FlashCookieManager/FlashCookieReader.py	Thu Sep 19 19:39:04 2019 +0200
@@ -231,7 +231,7 @@
         minOffset, = struct.unpack(">h", self.__data.read(2))
         # short, big-endian
         offset = minOffset // 60    # offset in hours
-        # Timezone: UTC + Offset
+        # Timezone is UTC + Offset
         value = QDateTime()
         value.setMSecsSinceEpoch(msec)
         value.setOffsetFromUtc(offset * 3600)
--- a/eric6/WebBrowser/FlashCookieManager/FlashCookieUtilities.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/WebBrowser/FlashCookieManager/FlashCookieUtilities.py	Thu Sep 19 19:39:04 2019 +0200
@@ -53,3 +53,6 @@
             flashPath = os.path.expanduser("~/.gnash")
     
     return flashPath
+
+#
+# eflag: noqa = M891
--- a/eric6/WebBrowser/Network/EricSchemeHandler.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/WebBrowser/Network/EricSchemeHandler.py	Thu Sep 19 19:39:04 2019 +0200
@@ -51,7 +51,6 @@
             job.reply(b"text/html", reply)
         else:
             job.reply(QByteArray(), QBuffer())
-            # job.fail(QWebEngineUrlRequestJob.UrlNotFound)
     
     def __replyClosed(self, reply):
         """
--- a/eric6/WebBrowser/Network/ProtocolHandlerManager.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/WebBrowser/Network/ProtocolHandlerManager.py	Thu Sep 19 19:39:04 2019 +0200
@@ -138,7 +138,7 @@
         page = QWebEnginePage(self)
         page.loadFinished.connect(page.deleteLater)
         try:
-            # Qt >= 5.11
+            # for Qt >= 5.11
             page.registerProtocolHandlerRequested.connect(
                 lambda r: r.accept())
         except AttributeError:
--- a/eric6/WebBrowser/OpenSearch/OpenSearchEngineModel.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/WebBrowser/OpenSearch/OpenSearchEngineModel.py	Thu Sep 19 19:39:04 2019 +0200
@@ -65,9 +65,6 @@
         for index in range(row, lastRow + 1):
             self.__manager.removeEngine(nameList[index])
         
-        # removeEngine emits changed()
-        #self.endRemoveRows()
-        
         return True
     
     def rowCount(self, parent=None):
--- a/eric6/WebBrowser/Passwords/PasswordModel.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/WebBrowser/Passwords/PasswordModel.py	Thu Sep 19 19:39:04 2019 +0200
@@ -86,9 +86,6 @@
         for index in range(row, lastRow + 1):
             self.__manager.removePassword(siteList[index])
         
-        # removeEngine emits changed()
-        #self.endRemoveRows()
-        
         return True
     
     def rowCount(self, parent=None):
--- a/eric6/WebBrowser/WebBrowserPage.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/WebBrowser/WebBrowserPage.py	Thu Sep 19 19:39:04 2019 +0200
@@ -41,7 +41,6 @@
         to signal an accepted navigation request
     """
     SafeJsWorld = QWebEngineScript.ApplicationWorld
-    # SafeJsWorld = QWebEngineScript.MainWorld
     UnsafeJsWorld = QWebEngineScript.MainWorld
     
     safeBrowsingAbort = pyqtSignal()
--- a/eric6/WebBrowser/WebBrowserView.py	Thu Sep 19 19:22:43 2019 +0200
+++ b/eric6/WebBrowser/WebBrowserView.py	Thu Sep 19 19:39:04 2019 +0200
@@ -2223,7 +2223,7 @@
             @type QWebEngineQuotaRequest
             """
             acceptRequest = Preferences.getWebBrowser("AcceptQuotaRequest")
-            # yes/no/ask (0, 1, 2)
+            # map yes/no/ask from (0, 1, 2)
             if acceptRequest == 0:
                 # always yes
                 ok = True

eric ide

mercurial