jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[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(-)

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()

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Icaaef4eef6d09556eba7514591a344e0258825fa
Gerrit-Change-Number: 462736
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)