jenkins-bot merged this change.

View Change

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

- use str.format(...) instead of modulo for type specifier
arguments.
- use single quotes for string literals
- remove preleading "u" fron strings

Change-Id: Ib56945ca33bfb616b5e0905314455755f96d3a46
---
M scripts/catall.py
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/scripts/catall.py b/scripts/catall.py
index 6885894..3903edb 100755
--- a/scripts/catall.py
+++ b/scripts/catall.py
@@ -46,23 +46,23 @@
xx: if the first, remove all categories and add no new.
q: quit.""")
while not done:
- choice = pywikibot.input(u"?")
- if choice == "":
+ choice = pywikibot.input('?')
+ if choice == '':
done = True
- elif choice == "-":
+ elif choice == '-':
chosen = choosecats(pagetext)
done = True
- elif choice == "?":
+ elif choice == '?':
from pywikibot import editor as editarticle
editor = editarticle.TextEditor()
editor.edit(pagetext)
- elif choice == "??":
+ elif choice == '??':
pywikibot.output(pagetext[0:length])
length = length + 500
- elif choice == "xx" and chosen == []:
+ elif choice == 'xx' and chosen == []:
chosen = None
done = True
- elif choice == "q":
+ elif choice == 'q':
raise QuitKeyboardInterrupt
else:
chosen.append(choice)
@@ -108,14 +108,14 @@
text = p.get()
cats = p.categories()
if not cats:
- pywikibot.output(u"========== %s ==========" % p.title())
+ pywikibot.output('========== {} =========='.format(p.title()))
pywikibot.output('No categories')
pywikibot.output('-' * 40)
newcats = choosecats(text)
if newcats != [] and newcats is not None:
make_categories(p, newcats, mysite)
elif docorrections:
- pywikibot.output(u"========== %s ==========" % p.title())
+ pywikibot.output('========== {} =========='.format(p.title()))
for c in cats:
pywikibot.output(c.title())
pywikibot.output('-' * 40)
@@ -125,10 +125,10 @@
elif newcats != []:
make_categories(p, newcats, mysite)
except pywikibot.IsRedirectPage:
- pywikibot.output(u'%s is a redirect' % p.title())
+ pywikibot.output('{} is a redirect'.format(p.title()))


-if __name__ == "__main__":
+if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:

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

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