jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/462301 )
Change subject: [cleanup] cleanup scripts/table2wiki.py
......................................................................
[cleanup] cleanup scripts/table2wiki.py
- remove preleading "u" from strings
- use single quotes for string literals and double quotes for
string literals **only** when they consist of single quotes
within them.
- use str.format(...) instead of modulo for strings with arguments
Change-Id: I73a6a62ecb10780d0a0f243854619293dcc4fa4f
---
M scripts/table2wiki.py
1 file changed, 19 insertions(+), 16 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/table2wiki.py b/scripts/table2wiki.py
index 2dc8c0f..cd2d7b6 100644
--- a/scripts/table2wiki.py
+++ b/scripts/table2wiki.py
@@ -179,7 +179,8 @@
r'\r\n! \g<header>\r\n', new_table)
if n > 0:
warning_messages.append(
- u'WARNING: found <th> without </th>. (%d occurences)\n' % n)
+ 'WARNING: found <th> without </th>. ({0} occurences)\n'
+ .format(n))
warnings += n
# <th> with attributes, without closing </th>
@@ -188,7 +189,8 @@
r'\n!\g<attr> | \g<header>\r\n', new_table)
if n > 0:
warning_messages.append(
- 'WARNING: found <th ...> without </th>. (%d occurences\n)' % n)
+ 'WARNING: found <th ...> without </th>. ({0} occurences\n)'
+ .format(n))
warnings += n
##################
@@ -222,7 +224,8 @@
r'\r\n| \g<cell>\r\n', new_table)
if n > 0:
warning_messages.append(
- u'<td> used where </td> was expected. (%d occurences)\n' % n)
+ '<td> used where </td> was expected. ({0} occurences)\n'
+ .format(n))
warnings += n
# what is this for?
@@ -231,8 +234,8 @@
r'\r\n|\2 | \3\r\n', new_table)
if n > 0:
warning_messages.append(
- u"WARNING: (sorry, bot code unreadable (1). I don't know why "
- u"this warning is given.) (%d occurences)\n" % n)
+ "WARNING: (sorry, bot code unreadable (1). I don't know why "
+ 'this warning is given.) ({0} occurences)\n'.format(n))
# fail save. sometimes people forget </td>
# <td> without arguments, with missing </td>
@@ -240,16 +243,16 @@
r'(?i)<td>(?P<cell>[^<]*?)[\r\n]+',
r'\r\n| \g<cell>\r\n', new_table)
if n > 0:
- warning_messages.append(u"NOTE: Found <td> without </td>. This "
- u"shouldn't cause problems.\n")
+ warning_messages.append('NOTE: Found <td> without </td>. This '
+ "shouldn't cause problems.\n")
# <td> with attributes, with missing </td>
new_table, n = re.subn(
r'(?i)[\r\n]*<td(?P<attr> [^>]*?)>(?P<cell>[\w\W]*?)[\r\n]+',
r'\r\n|\g<attr> | \g<cell>\r\n', new_table)
if n > 0:
- warning_messages.append(u"NOTE: Found <td> without </td>. This "
- u"shouldn't cause problems.\n")
+ warning_messages.append('NOTE: Found <td> without </td>. This '
+ "shouldn't cause problems.\n")
##################
# Garbage collecting ;-)
@@ -474,23 +477,23 @@
# Check if there are any marked tags left
if re.search('<##table##|</##table##>', new_text, re.IGNORECASE):
pywikibot.error(
- u'not all marked table start or end tags processed!')
+ 'not all marked table start or end tags processed!')
return
if converted_tables == 0:
- pywikibot.output(u"No changes were necessary.")
+ pywikibot.output('No changes were necessary.')
return
if warnings:
if self.getOption('always') and self.getOption('skipwarning'):
pywikibot.output(
- 'There were %i replacements that might lead to bad '
- 'output. Skipping.' % warnings)
+ 'There were {0} replacements that might lead to bad '
+ 'output. Skipping.'.format(warnings))
return
if not self.getOption('always'):
pywikibot.output(
- 'There were %i replacements that might lead to bad '
- 'output.' % warnings)
+ 'There were {0} replacements that might lead to bad '
+ 'output.'.format(warnings))
if not input_yn('Do you want to change the page anyway'):
return
@@ -579,5 +582,5 @@
return False
-if __name__ == "__main__":
+if __name__ == '__main__':
main()
--
To view, visit https://gerrit.wikimedia.org/r/462301
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I73a6a62ecb10780d0a0f243854619293dcc4fa4f
Gerrit-Change-Number: 462301
Gerrit-PatchSet: 2
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/462293 )
Change subject: Avoid crash in Coordinate initializer
......................................................................
Avoid crash in Coordinate initializer
When site is None, it falls back to the default. But this is reflected
in the instance variable, not this one.
Change-Id: Icf544e86d6765bdbe91b27e14e6b7948034e8b4f
---
M pywikibot/__init__.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index c9230c0..bd0a366 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -306,7 +306,7 @@
if globe:
globe = globe.lower()
elif not globe_item:
- globe = site.default_globe()
+ globe = self.site.default_globe()
self.globe = globe
@property
--
To view, visit https://gerrit.wikimedia.org/r/462293
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Icf544e86d6765bdbe91b27e14e6b7948034e8b4f
Gerrit-Change-Number: 462293
Gerrit-PatchSet: 1
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/462281 )
Change subject: [cleanup] cleanup scripts/upload.py
......................................................................
[cleanup] cleanup scripts/upload.py
- removing preleading "u" from strings
- use single quotes for string literals
Change-Id: Ia3ca4f2e60eca45ce54b9c412fc39f88848e3105
---
M scripts/upload.py
1 file changed, 4 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/upload.py b/scripts/upload.py
index c9a44c1..16cb277 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -102,7 +102,7 @@
@param args: command line arguments
@type args: unicode
"""
- url = u''
+ url = ''
description = []
summary = None
keep_filename = False
@@ -171,7 +171,7 @@
encoding=pywikibot.config.textfile_encoding) as f:
description = f.read().replace('\r\n', '\n')
- while not ("://" in url or os.path.exists(url)):
+ while not ('://' in url or os.path.exists(url)):
if not url:
error = 'No input filename given.'
else:
@@ -183,7 +183,7 @@
break
else:
pywikibot.output(error)
- url = pywikibot.input(u'URL, file or directory where files are now:')
+ url = pywikibot.input('URL, file or directory where files are now:')
if always and ((aborts is not True and ignorewarn is not True) or
not description or url is None):
@@ -222,5 +222,5 @@
bot.run()
-if __name__ == "__main__":
+if __name__ == '__main__':
main()
--
To view, visit https://gerrit.wikimedia.org/r/462281
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia3ca4f2e60eca45ce54b9c412fc39f88848e3105
Gerrit-Change-Number: 462281
Gerrit-PatchSet: 1
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/462284 )
Change subject: [cleanup] cleanup scripts/unusedfiles.py
......................................................................
[cleanup] cleanup scripts/unusedfiles.py
- remove preleading "u" from strings
- use single quotes for string literals
- use str.format(...) instead of modulo for changed files
Change-Id: I41e25cd244526d1b2edc5f3d89c91c512767b5dd
---
M scripts/unusedfiles.py
1 file changed, 11 insertions(+), 11 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index 6d30234..4465b40 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -26,8 +26,8 @@
template_to_the_image = {
'meta': '{{Orphan file}}',
- 'it': u'{{immagine orfana}}',
- 'fa': u'{{تصاویر بدون استفاده}}',
+ 'it': '{{immagine orfana}}',
+ 'fa': '{{تصاویر بدون استفاده}}',
'ur': '{{غیر مستعمل تصاویر}}',
}
@@ -57,22 +57,22 @@
self.summary = i18n.twtranslate(self.site, 'unusedfiles-comment')
if not (self.template_image and
(self.template_user or self.getOption('nouserwarning'))):
- raise pywikibot.Error(u'This script is not localized for %s site.'
- % self.site)
+ raise pywikibot.Error('This script is not localized for {0} site.'
+ .format(self.site))
def treat(self, image):
"""Process one image page."""
if not image.exists():
- pywikibot.output("File '%s' does not exist (see bug T71133)."
- % image.title())
+ pywikibot.output("File '{0}' does not exist (see bug T71133)."
+ .format(image.title()))
return
# Use fileUrl() and fileIsShared() to confirm it is local media
# rather than a local page with the same name as shared media.
if (image.fileUrl() and not image.fileIsShared() and
- u'http://' not in image.text):
+ 'http://' not in image.text):
if self.template_image in image.text:
- pywikibot.output(u"%s done already"
- % image.title(as_link=True))
+ pywikibot.output('{0} done already'
+ .format(image.title(as_link=True)))
return
self.append_text(image, '\n\n' + self.template_image)
@@ -92,7 +92,7 @@
text = page.text
else:
if page.isTalkPage():
- text = u''
+ text = ''
else:
raise pywikibot.NoPage(page)
@@ -136,5 +136,5 @@
return True
-if __name__ == "__main__":
+if __name__ == '__main__':
main()
--
To view, visit https://gerrit.wikimedia.org/r/462284
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I41e25cd244526d1b2edc5f3d89c91c512767b5dd
Gerrit-Change-Number: 462284
Gerrit-PatchSet: 1
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)