jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/362976 )
Change subject: Fix some of the invalid escape sequences ...................................................................... Fix some of the invalid escape sequences Bug: T164575 Change-Id: Idf8a01717db55309a1cb18a3c82fce783a5b4976 --- M pywikibot/config2.py M scripts/imagecopy.py M scripts/imagecopy_self.py M scripts/table2wiki.py 4 files changed, 14 insertions(+), 13 deletions(-) Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved diff --git a/pywikibot/config2.py b/pywikibot/config2.py index 0d82f2d..35f248d 100644 --- a/pywikibot/config2.py +++ b/pywikibot/config2.py @@ -936,7 +936,7 @@ key1 = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_name) _progID = winreg.EnumValue(key1, 0)[0] _key2 = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, - '%s\shell\open\command' % _progID) + r'%s\shell\open\command' % _progID) _cmd = _winreg.QueryValueEx(_key2, None)[0] # See T102465 for issues relating to using this value. cmd = _cmd diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py index 80e53eb..7d836a3 100644 --- a/scripts/imagecopy.py +++ b/scripts/imagecopy.py @@ -352,11 +352,11 @@ def fixAuthor(self, pageText): """Fix the author field in the information template.""" informationRegex = re.compile( - '\|Author\=Original uploader was ' - '(?P<author>\[\[:\w+:\w+:\w+\|\w+\]\] at \[.+\])') + r'\|Author=Original uploader was ' + r'(?P<author>\[\[:\w+:\w+:\w+\|\w+\]\] at \[.+\])') selfRegex = re.compile( - '\{\{self\|author\=' - '(?P<author>\[\[:\w+:\w+:\w+\|\w+\]\] at \[.+\])\|') + r'{{self\|author=' + r'(?P<author>\[\[:\w+:\w+:\w+\|\w+\]\] at \[.+\])\|') # Find the |Author=Original uploader was .... informationMatch = informationRegex.search(pageText) @@ -485,8 +485,8 @@ saltos = getautoskip() # print saltos for salto in saltos: - rex = u'\{\{\s*[' + salto[0].upper() + salto[0].lower() + ']' + \ - salto[1:] + '(\}\}|\|)' + rex = r'\{\{\s*[' + salto[0].upper() + salto[0].lower() + r']' + \ + salto[1:] + r'(\}\}|\|)' # print rex if re.search(rex, pagetext): return True diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py index aa7d1f2..c45fe22 100644 --- a/scripts/imagecopy_self.py +++ b/scripts/imagecopy_self.py @@ -580,8 +580,8 @@ lang = sourceSite.code family = sourceSite.family.name conversions = [ - (u'\[\[([^\[\]\|]+)\|([^\[\]\|]+)\]\]', u'[[:%(lang)s:\\1|\\2]]'), - (u'\[\[([^\[\]\|]+)\]\]', u'[[:%(lang)s:\\1|\\1]]'), + (r'\[\[([^\[\]\|]+)\|([^\[\]\|]+)\]\]', r'[[:%(lang)s:\1|\2]]'), + (r'\[\[([^\[\]\|]+)\]\]', r'[[:%(lang)s:\1|\1]]'), ] for (regex, replacement) in conversions: text = re.sub(regex, replacement % {u'lang': lang, @@ -992,8 +992,8 @@ if imagepage.site.lang in moveToCommonsTemplate: for moveTemplate in moveToCommonsTemplate[ imagepage.site.lang]: - imtxt = re.sub(u'(?i)\{\{' + moveTemplate + - u'[^\}]*\}\}', u'', imtxt) + imtxt = re.sub(r'(?i){{' + moveTemplate + + r'[^}]*}}', r'', imtxt) # add {{NowCommons}} if imagepage.site.lang in nowCommonsTemplate: diff --git a/scripts/table2wiki.py b/scripts/table2wiki.py index 82dba5b..3d41b20 100644 --- a/scripts/table2wiki.py +++ b/scripts/table2wiki.py @@ -226,8 +226,9 @@ # warnings += n # what is this for? - newTable, n = re.subn("[\r\n]+<(td|TD)([^>]+?)>([^\r\n]*?)<\/(td|TD)>", - r"\r\n|\2 | \3\r\n", newTable) + newTable, n = re.subn( + r'[\r\n]+<(td|TD)([^>]+?)>([^\r\n]*?)</(td|TD)>', + r'\r\n|\2 | \3\r\n', newTable) if n > 0: warning_messages.append( u"WARNING: (sorry, bot code unreadable (1). I don't know why " -- To view, visit https://gerrit.wikimedia.org/r/362976 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idf8a01717db55309a1cb18a3c82fce783a5b4976 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Dalba <dalba.w...@gmail.com> Gerrit-Reviewer: Dalba <dalba.w...@gmail.com> Gerrit-Reviewer: Magul <tomasz.magul...@gmail.com> Gerrit-Reviewer: Xqt <i...@gno.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits