Corrected some code style issues detected by the new pycodestyle version.

Sat, 14 Apr 2018 15:08:24 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 14 Apr 2018 15:08:24 +0200
changeset 6247
5c677a7f7d51
parent 6246
fe07a9f16f23
child 6249
4aef9f5f0989

Corrected some code style issues detected by the new pycodestyle version.

Helpviewer/Bookmarks/NsHtmlReader.py file | annotate | diff | comparison | revisions
Helpviewer/GreaseMonkey/GreaseMonkeyJavaScript.py file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsGit/GitBlameDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignaturesDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py file | annotate | diff | comparison | revisions
Preferences/ConfigurationPages/CooperationPage.py file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
QScintilla/Exporters/ExporterRTF.py file | annotate | diff | comparison | revisions
QScintilla/Lexers/LexerPython.py file | annotate | diff | comparison | revisions
QScintilla/MiniEditor.py file | annotate | diff | comparison | revisions
QScintilla/TypingCompleters/CompleterPython.py file | annotate | diff | comparison | revisions
QScintilla/TypingCompleters/CompleterRuby.py file | annotate | diff | comparison | revisions
UI/CompareDialog.py file | annotate | diff | comparison | revisions
UI/FindFileDialog.py file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
ViewManager/ViewManager.py file | annotate | diff | comparison | revisions
WebBrowser/Bookmarks/NsHtmlReader.py file | annotate | diff | comparison | revisions
--- a/Helpviewer/Bookmarks/NsHtmlReader.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Helpviewer/Bookmarks/NsHtmlReader.py	Sat Apr 14 15:08:24 2018 +0200
@@ -46,15 +46,15 @@
         
         self.__urlRx = QRegExp('HREF="(.*)"', Qt.CaseInsensitive)
         self.__urlRx.setMinimal(True)
-        
-        self.__addedRx = QRegExp('ADD_DATE="(\d*)"', Qt.CaseInsensitive)
+
+        self.__addedRx = QRegExp(r'ADD_DATE="(\d*)"', Qt.CaseInsensitive)
         self.__addedRx.setMinimal(True)
         
         self.__modifiedRx = QRegExp(
-            'LAST_MODIFIED="(\d*)"', Qt.CaseInsensitive)
+            r'LAST_MODIFIED="(\d*)"', Qt.CaseInsensitive)
         self.__modifiedRx.setMinimal(True)
         
-        self.__visitedRx = QRegExp('LAST_VISIT="(\d*)"', Qt.CaseInsensitive)
+        self.__visitedRx = QRegExp(r'LAST_VISIT="(\d*)"', Qt.CaseInsensitive)
         self.__visitedRx.setMinimal(True)
         
         self.__foldedRx = QRegExp("FOLDED", Qt.CaseInsensitive)
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyJavaScript.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Helpviewer/GreaseMonkey/GreaseMonkeyJavaScript.py	Sat Apr 14 15:08:24 2018 +0200
@@ -53,7 +53,7 @@
             document.onreadystatechange = function() {
                 if (document.readyState == "interactive") {
                   var oStyle = document.createElement("style");
-                  oStyle.setAttribute("type", "text\/css");
+                  oStyle.setAttribute("type", "text/css");
                   oStyle.appendChild(document.createTextNode(styles));
                   document.getElementsByTagName("head")[0].appendChild(oStyle);
                 }
@@ -61,7 +61,7 @@
         }
         else {
             var oStyle = document.createElement("style");
-            oStyle.setAttribute("type", "text\/css");
+            oStyle.setAttribute("type", "text/css");
             oStyle.appendChild(document.createTextNode(styles));
             head.appendChild(oStyle);
         }
--- a/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py	Sat Apr 14 15:08:24 2018 +0200
@@ -253,7 +253,8 @@
         @rtype tuple of int and str
         """
         for lineno, line in enumerate(self.__source[:5]):
-            matched = re.search('coding[:=]\s*([-\w_.]+)', line, re.IGNORECASE)
+            matched = re.search(r'coding[:=]\s*([-\w_.]+)',
+                                line, re.IGNORECASE)
             if matched:
                 return lineno, matched.group(1)
         else:
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py	Sat Apr 14 15:08:24 2018 +0200
@@ -273,7 +273,7 @@
         lines = traceback.format_exception_only(SyntaxError, detail)
         if sys.version_info[0] == 2:
             lines = [x.decode(sys.getfilesystemencoding()) for x in lines]
-        match = re.match('\s*File "(.+)", line (\d+)',
+        match = re.match(r'\s*File "(.+)", line (\d+)',
                          lines[0].replace('<string>', filename))
         if match is not None:
             fn, line = match.group(1, 2)
--- a/Plugins/VcsPlugins/vcsGit/GitBlameDialog.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Plugins/VcsPlugins/vcsGit/GitBlameDialog.py	Sat Apr 14 15:08:24 2018 +0200
@@ -51,7 +51,7 @@
         
         self.__blameRe = re.compile(
             r"""\^?([0-9a-fA-F]+)\s+\((.+)\s+(\d{4}-\d{2}-\d{2})\s+"""
-            """(\d{2}:\d{2}):\d{2}\s+[+-]\d{4}\s+(\d+)\)\s?(.*)""")
+            r"""(\d{2}:\d{2}):\d{2}\s+[+-]\d{4}\s+(\d+)\)\s?(.*)""")
         # commit - author - date - time - lineno. - text
         
         self.blameList.headerItem().setText(
--- a/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py	Sat Apr 14 15:08:24 2018 +0200
@@ -1195,7 +1195,7 @@
             fieldIndex = self.CommitIdColumn
             txt = self.rxEdit.text()
             if txt.startswith("^"):
-                searchRx = QRegExp("^\s*{0}".format(txt[1:]),
+                searchRx = QRegExp(r"^\s*{0}".format(txt[1:]),
                                    Qt.CaseInsensitive)
             else:
                 searchRx = QRegExp(txt, Qt.CaseInsensitive)
--- a/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignaturesDialog.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignaturesDialog.py	Sat Apr 14 15:08:24 2018 +0200
@@ -319,7 +319,7 @@
         filterTop = self.categoryCombo.currentText() == self.tr("Revision")
         if filterTop and searchRxText.startswith("^"):
             searchRx = QRegExp(
-                "^\s*{0}".format(searchRxText[1:]), Qt.CaseInsensitive)
+                r"^\s*{0}".format(searchRxText[1:]), Qt.CaseInsensitive)
         else:
             searchRx = QRegExp(searchRxText, Qt.CaseInsensitive)
         for topIndex in range(self.signaturesList.topLevelItemCount()):
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Sat Apr 14 15:08:24 2018 +0200
@@ -1905,7 +1905,7 @@
             fieldIndex = self.RevisionColumn
             txt = self.rxEdit.text()
             if txt.startswith("^"):
-                searchRx = QRegExp("^\s*{0}".format(txt[1:]),
+                searchRx = QRegExp(r"^\s*{0}".format(txt[1:]),
                                    Qt.CaseInsensitive)
             else:
                 searchRx = QRegExp(txt, Qt.CaseInsensitive)
--- a/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Plugins/VcsPlugins/vcsPySvn/SvnLogBrowserDialog.py	Sat Apr 14 15:08:24 2018 +0200
@@ -577,7 +577,7 @@
                 txt = self.rxEdit.text()
                 if txt.startswith("^"):
                     searchRx = QRegExp(
-                        "^\s*{0}".format(txt[1:]), Qt.CaseInsensitive)
+                        r"^\s*{0}".format(txt[1:]), Qt.CaseInsensitive)
                 else:
                     searchRx = QRegExp(txt, Qt.CaseInsensitive)
             else:
--- a/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Plugins/VcsPlugins/vcsSubversion/SvnLogBrowserDialog.py	Sat Apr 14 15:08:24 2018 +0200
@@ -74,12 +74,12 @@
         self.rx_sep1 = QRegExp('\\-+\\s*')
         self.rx_sep2 = QRegExp('=+\\s*')
         self.rx_rev1 = QRegExp(
-            'rev ([0-9]+):  ([^|]*) \| ([^|]*) \| ([0-9]+) .*')
+            r'rev ([0-9]+):  ([^|]*) \| ([^|]*) \| ([0-9]+) .*')
         # "rev" followed by one or more decimals followed by a colon followed
         # anything up to " | " (twice) followed by one or more decimals
         # followed by anything
         self.rx_rev2 = QRegExp(
-            'r([0-9]+) \| ([^|]*) \| ([^|]*) \| ([0-9]+) .*')
+            r'r([0-9]+) \| ([^|]*) \| ([^|]*) \| ([0-9]+) .*')
         # "r" followed by one or more decimals followed by " | " followed
         # anything up to " | " (twice) followed by one or more decimals
         # followed by anything
@@ -664,7 +664,7 @@
                 txt = self.rxEdit.text()
                 if txt.startswith("^"):
                     searchRx = QRegExp(
-                        "^\s*{0}".format(txt[1:]), Qt.CaseInsensitive)
+                        r"^\s*{0}".format(txt[1:]), Qt.CaseInsensitive)
                 else:
                     searchRx = QRegExp(txt, Qt.CaseInsensitive)
             else:
--- a/Preferences/ConfigurationPages/CooperationPage.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Preferences/ConfigurationPages/CooperationPage.py	Sat Apr 14 15:08:24 2018 +0200
@@ -31,9 +31,9 @@
         self.setObjectName("CooperationPage")
         
         self.__bannedUserValidator = QRegExpValidator(
-            QRegExp("[a-zA-Z0-9.-]+@"
-                    "(?:(?:2(?:[0-4][0-9]|5[0-5])|[01]?[0-9]{1,2})\.){3}"
-                    "(?:2(?:[0-4][0-9]|5[0-5])|[01]?[0-9]{1,2})"),
+            QRegExp(r"[a-zA-Z0-9.-]+@"
+                    r"(?:(?:2(?:[0-4][0-9]|5[0-5])|[01]?[0-9]{1,2})\.){3}"
+                    r"(?:2(?:[0-4][0-9]|5[0-5])|[01]?[0-9]{1,2})"),
             self.bannedUserEdit)
         self.bannedUserEdit.setValidator(self.__bannedUserValidator)
         
--- a/QScintilla/Editor.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/QScintilla/Editor.py	Sat Apr 14 15:08:24 2018 +0200
@@ -3399,10 +3399,10 @@
             cs = Qt.CaseInsensitive
         wc = self.wordCharacters()
         if wc is None or not useWordChars:
-            regExp = QRegExp('[^\w_]', cs)
-        else:
-            wc = re.sub('\w', "", wc)
-            regExp = QRegExp('[^\w{0}]'.format(re.escape(wc)), cs)
+            regExp = QRegExp(r'[^\w_]', cs)
+        else:
+            wc = re.sub(r'\w', "", wc)
+            regExp = QRegExp(r'[^\w{0}]'.format(re.escape(wc)), cs)
         start = regExp.lastIndexIn(text, index) + 1
         end = regExp.indexIn(text, index)
         if start == end + 1 and index > 0:
@@ -4691,7 +4691,7 @@
     ## auto-completion hook interfaces
     #################################################################
     
-    def addCompletionListHook(self, key, func, async=False):
+    def addCompletionListHook(self, key, func, asynchroneous=False):
         """
         Public method to set an auto-completion list provider.
         
@@ -4704,7 +4704,7 @@
         @type function(editor, bool) -> list of str in case async is False
             and function(editor, bool, str) returning nothing in case async
             is True
-        @param async flag indicating an asynchroneous function
+        @param asynchroneous flag indicating an asynchroneous function
         @type bool
         """
         if key in self.__completionListHookFunctions or \
@@ -4725,7 +4725,7 @@
             self.SCN_CHARADDED.connect(self.__charAdded)
             self.SCN_AUTOCCANCELLED.connect(self.__autocompletionCancelled)
         
-        if async:
+        if asynchroneous:
             self.__completionListAsyncHookFunctions[key] = func
         else:
             self.__completionListHookFunctions[key] = func
--- a/QScintilla/Exporters/ExporterRTF.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/QScintilla/Exporters/ExporterRTF.py	Sat Apr 14 15:08:24 2018 +0200
@@ -42,7 +42,7 @@
     RTF_INFOCLOSE = "}"
     RTF_COMMENT = "{\\comment Generated by eric6's RTF export filter.}"
     # to be used by strftime
-    RTF_CREATED = "{\creatim\yr%Y\mo%m\dy%d\hr%H\min%M\sec%S}"
+    RTF_CREATED = r"{\creatim\yr%Y\mo%m\dy%d\hr%H\min%M\sec%S}"
     RTF_BODYOPEN = ""
     RTF_BODYCLOSE = "}"
 
--- a/QScintilla/Lexers/LexerPython.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/QScintilla/Lexers/LexerPython.py	Sat Apr 14 15:08:24 2018 +0200
@@ -88,7 +88,7 @@
         lead_spaces = editor.indentation(line)
         
         pline = line - 1
-        while pline >= 0 and re.match('^\s*(#.*)?$', editor.text(pline)):
+        while pline >= 0 and re.match(r'^\s*(#.*)?$', editor.text(pline)):
             pline -= 1
         
         if pline < 0:
@@ -96,13 +96,13 @@
         else:
             previous_lead_spaces = editor.indentation(pline)
             # trailing spaces
-            m = re.search(':\s*(#.*)?$', editor.text(pline))
+            m = re.search(r':\s*(#.*)?$', editor.text(pline))
             last = previous_lead_spaces
             if m:
                 last += indent_width
             else:
                 # special cases, like pass (unindent) or return (also unindent)
-                m = re.search('(pass\s*(#.*)?$)|(^[^#]return)',
+                m = re.search(r'(pass\s*(#.*)?$)|(^[^#]return)',
                               editor.text(pline))
                 if m:
                     last -= indent_width
--- a/QScintilla/MiniEditor.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/QScintilla/MiniEditor.py	Sat Apr 14 15:08:24 2018 +0200
@@ -3194,10 +3194,10 @@
             cs = Qt.CaseInsensitive
         wc = self.__textEdit.wordCharacters()
         if wc is None:
-            regExp = QRegExp('[^\w_]', cs)
+            regExp = QRegExp(r'[^\w_]', cs)
         else:
-            wc = re.sub('\w', "", wc)
-            regExp = QRegExp('[^\w{0}]'.format(re.escape(wc)), cs)
+            wc = re.sub(r'\w', "", wc)
+            regExp = QRegExp(r'[^\w{0}]'.format(re.escape(wc)), cs)
         start = regExp.lastIndexIn(text, index) + 1
         end = regExp.indexIn(text, index)
         if start == end + 1 and index > 0:
--- a/QScintilla/TypingCompleters/CompleterPython.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/QScintilla/TypingCompleters/CompleterPython.py	Sat Apr 14 15:08:24 2018 +0200
@@ -212,7 +212,7 @@
                 txt = self.editor.text(line - 1)
                 if re.search(":\r?\n", txt) is None:
                     openCount = len(re.findall("[({[]", txt))
-                    closeCount = len(re.findall("[)}\]]", txt))
+                    closeCount = len(re.findall(r"[)}\]]", txt))
                     if openCount > closeCount:
                         openCount = 0
                         closeCount = 0
@@ -222,7 +222,7 @@
                             lastOpenIndex = openList[index].start()
                             txt2 = txt[lastOpenIndex:]
                             openCount = len(re.findall("[({[]", txt2))
-                            closeCount = len(re.findall("[)}\]]", txt2))
+                            closeCount = len(re.findall(r"[)}\]]", txt2))
                             index -= 1
                         if openCount > closeCount and lastOpenIndex > col:
                             self.editor.insert(' ' * (lastOpenIndex - col + 1))
--- a/QScintilla/TypingCompleters/CompleterRuby.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/QScintilla/TypingCompleters/CompleterRuby.py	Sat Apr 14 15:08:24 2018 +0200
@@ -142,7 +142,7 @@
                 self.editor.insert(self.__hereRX.cap(1))
             elif self.__indentBrace and re.search(":\r?\n", txt) is None:
                 openCount = len(re.findall("[({[]", txt))
-                closeCount = len(re.findall("[)}\]]", txt))
+                closeCount = len(re.findall(r"[)}\]]", txt))
                 if openCount > closeCount:
                     openCount = 0
                     closeCount = 0
@@ -152,7 +152,7 @@
                         lastOpenIndex = openList[index].start()
                         txt2 = txt[lastOpenIndex:]
                         openCount = len(re.findall("[({[]", txt2))
-                        closeCount = len(re.findall("[)}\]]", txt2))
+                        closeCount = len(re.findall(r"[)}\]]", txt2))
                         index -= 1
                     if openCount > closeCount and lastOpenIndex > col:
                         self.editor.insert(' ' * (lastOpenIndex - col + 1))
--- a/UI/CompareDialog.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/UI/CompareDialog.py	Sat Apr 14 15:08:24 2018 +0200
@@ -145,7 +145,7 @@
         self.diffParas = []
         self.currentDiffPos = -1
         
-        self.markerPattern = "\0\+|\0\^|\0\-"
+        self.markerPattern = r"\0\+|\0\^|\0\-"
         
         if len(files) == 2:
             self.filesGroup.hide()
--- a/UI/FindFileDialog.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/UI/FindFileDialog.py	Sat Apr 14 15:08:24 2018 +0200
@@ -313,7 +313,7 @@
         if self.filterCheckBox.isChecked():
             fileFilter = self.filterEdit.text()
             fileFilterList = \
-                ["^{0}$".format(filter.replace(".", "\.").replace("*", ".*"))
+                ["^{0}$".format(filter.replace(".", r"\.").replace("*", ".*"))
                  for filter in fileFilter.split(";")]
             filterRe = re.compile("|".join(fileFilterList))
         
@@ -341,7 +341,7 @@
                 if self.sourcesCheckBox.isChecked():
                     filters.extend(
                         ["^{0}$".format(
-                            assoc.replace(".", "\.").replace("*", ".*"))
+                            assoc.replace(".", r"\.").replace("*", ".*"))
                          for assoc in list(
                              Preferences.getEditorLexerAssocs().keys())
                          if assoc not in self.formsExt + self.interfacesExt +
--- a/Utilities/__init__.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/Utilities/__init__.py	Sat Apr 14 15:08:24 2018 +0200
@@ -539,7 +539,7 @@
     text = pattern.sub(escape_uentities, text)
     return text
 
-_uunescape = re.compile('&#\d+;')
+_uunescape = re.compile(r'&#\d+;')
 
 
 def unescape_uentities(m):
--- a/ViewManager/ViewManager.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/ViewManager/ViewManager.py	Sat Apr 14 15:08:24 2018 +0200
@@ -5830,7 +5830,7 @@
         line, index = aw.getCursorPosition()
         text = aw.text(line)
         
-        reg = QRegExp('[^\w_]')
+        reg = QRegExp(r'[^\w_]')
         end = reg.indexIn(text, index)
         if end > index:
             ext = text[index:end]
@@ -7033,7 +7033,7 @@
         if self.activeWindow() is not None and \
            self.activeWindow().getFileName():
             ext = os.path.splitext(self.activeWindow().getFileName())[1]
-            rx = QRegExp(".*\*\.{0}[ )].*".format(ext[1:]))
+            rx = QRegExp(r".*\*\.{0}[ )].*".format(ext[1:]))
             import QScintilla.Lexers
             filters = QScintilla.Lexers.getOpenFileFiltersList()
             index = -1
--- a/WebBrowser/Bookmarks/NsHtmlReader.py	Fri Apr 13 22:32:32 2018 +0200
+++ b/WebBrowser/Bookmarks/NsHtmlReader.py	Sat Apr 14 15:08:24 2018 +0200
@@ -47,14 +47,14 @@
         self.__urlRx = QRegExp('HREF="(.*)"', Qt.CaseInsensitive)
         self.__urlRx.setMinimal(True)
         
-        self.__addedRx = QRegExp('ADD_DATE="(\d*)"', Qt.CaseInsensitive)
+        self.__addedRx = QRegExp(r'ADD_DATE="(\d*)"', Qt.CaseInsensitive)
         self.__addedRx.setMinimal(True)
         
         self.__modifiedRx = QRegExp(
-            'LAST_MODIFIED="(\d*)"', Qt.CaseInsensitive)
+            r'LAST_MODIFIED="(\d*)"', Qt.CaseInsensitive)
         self.__modifiedRx.setMinimal(True)
         
-        self.__visitedRx = QRegExp('LAST_VISIT="(\d*)"', Qt.CaseInsensitive)
+        self.__visitedRx = QRegExp(r'LAST_VISIT="(\d*)"', Qt.CaseInsensitive)
         self.__visitedRx.setMinimal(True)
         
         self.__foldedRx = QRegExp("FOLDED", Qt.CaseInsensitive)

eric ide

mercurial