jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/462549 )
Change subject: [cleanup] cleanup scripts/imagerecat.py ......................................................................
[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(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
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):