jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[cleanup] cleanup scripts/imagerecat.py

- use str.format(...) instead of modulo for type specifier
arguments
- remove preleading "u" from strings

Change-Id: I104c3254e601994df7730bd3298a908bd28adbd8
---
M scripts/imagerecat.py
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/imagerecat.py b/scripts/imagerecat.py
index d6996f9..8af4a9a 100755
--- a/scripts/imagerecat.py
+++ b/scripts/imagerecat.py
@@ -253,8 +253,8 @@
pywikibot.output('Dropping {}, {}'
.format(addresspart.tag, addresspart.text))
else:
- pywikibot.warning('%s, %s is not in addressparts lists'
- % (addresspart.tag, addresspart.text))
+ pywikibot.warning('{}, {} is not in addressparts lists'
+ .format(addresspart.tag, addresspart.text))
return result


@@ -324,7 +324,7 @@
"""Filter out disambiguation categories."""
result = []
for cat in categories:
- if (not pywikibot.Page(pywikibot.Site(u'commons', u'commons'),
+ if (not pywikibot.Page(pywikibot.Site('commons', 'commons'),
cat, ns=14).isDisambig()):
result.append(cat)
return result
@@ -334,7 +334,7 @@
"""If a category is a redirect, replace the category with the target."""
result = []
for cat in categories:
- categoryPage = pywikibot.Page(pywikibot.Site(u'commons', u'commons'),
+ categoryPage = pywikibot.Page(pywikibot.Site('commons', 'commons'),
cat, ns=14)
if categoryPage.isCategoryRedirect():
result.append(
@@ -358,7 +358,7 @@
listByCountry = []
listCountries = []
for cat in categories:
- if cat.endswith(u'by country'):
+ if cat.endswith('by country'):
listByCountry.append(cat)

# If cat contains 'by country' add it to the list
@@ -370,7 +370,7 @@
if len(listByCountry) > 0:
for bc in listByCountry:
category = pywikibot.Category(
- pywikibot.Site(u'commons', u'commons'), u'Category:' + bc)
+ pywikibot.Site('commons', 'commons'), 'Category:' + bc)
for subcategory in category.subcategories():
for country in listCountries:
if subcategory.title(with_ns=False).endswith(country):

To view, visit change 462549. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I104c3254e601994df7730bd3298a908bd28adbd8
Gerrit-Change-Number: 462549
Gerrit-PatchSet: 1
Gerrit-Owner: D3r1ck01 <alangiderick@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)