jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/462736 )
Change subject: [cleanup] cleanup scripts/create_categories.py ......................................................................
[cleanup] cleanup scripts/create_categories.py
- use str.format(...) instead of modulo for type specifier arguments. - use single quotes for string literals - remove preleading "u" from strings
Change-Id: Icaaef4eef6d09556eba7514591a344e0258825fa --- M scripts/create_categories.py 1 file changed, 7 insertions(+), 6 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/create_categories.py b/scripts/create_categories.py index 3f0e651..1755a72 100755 --- a/scripts/create_categories.py +++ b/scripts/create_categories.py @@ -53,16 +53,16 @@ self.generator = generator self.parent = parent self.basename = basename - self.comment = u'Creating new category' + self.comment = 'Creating new category'
def treat(self, page): """Create category in commons for that page.""" title = page.title(with_ns=False)
newpage = pywikibot.Category(pywikibot.Site('commons', 'commons'), - '%s %s' % (self.basename, title)) - newtext = (u'[[Category:%(parent)s|%(title)s]]\n' - u'[[Category:%(title)s]]\n' + '{} {}'.format(self.basename, title)) + newtext = ('[[Category:%(parent)s|%(title)s]]\n' + '[[Category:%(title)s]]\n' % {'parent': self.parent, 'title': title})
if not newpage.exists(): @@ -72,7 +72,8 @@ ignore_server_errors=True) else: # FIXME: Add overwrite option - pywikibot.output(u'%s already exists, skipping' % newpage.title()) + pywikibot.output('{} already exists, skipping' + .format(newpage.title()))
def main(*args): @@ -120,5 +121,5 @@ return False
-if __name__ == "__main__": +if __name__ == '__main__': main()