jenkins-bot merged this change.

View Change

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

- remove preleading "u" fron strings
- use double quotes *only* on string literals with single quotes
else use single quotes on string literals
- use str.format(...) on changed lines with modulo

Change-Id: Iecde63ea817ee929daa2a4120ca22e2ec3c39f39
---
M scripts/template.py
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/template.py b/scripts/template.py
index 14741e0..5d08827 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -161,7 +161,7 @@
for template in self.templates:
template_pattern = template.title(with_ns=False)
if mysite.namespaces[10].case == 'first-letter':
- template_pattern = '[%s%s]%s' % (
+ template_pattern = '[{0}{1}]{2}'.format(
template_pattern[0].upper(), template_pattern[0].lower(),
template_pattern[1:])
template_pattern = re.sub(' ', '[_ ]', template_pattern)
@@ -247,7 +247,8 @@
else:
template = pywikibot.Page(self.site, new, ns=10)
if not template.exists():
- pywikibot.warning(u'Template "%s" does not exist.' % new)
+ pywikibot.warning('Template "{0}" does not exist.'
+ .format(new))
if not pywikibot.input_yn('Do you want to proceed anyway?',
default=False,
automatic_quit=False):
@@ -303,7 +304,7 @@
elif arg.startswith('-xml'):
if len(arg) == 4:
xmlfilename = pywikibot.input(
- u'Please enter the XML dump\'s filename: ')
+ "Please enter the XML dump's filename: ")
else:
xmlfilename = arg[5:]
elif arg.startswith('-addcat:'):
@@ -377,8 +378,8 @@
bot.run()


-if __name__ == "__main__":
+if __name__ == '__main__':
try:
main()
except Exception:
- pywikibot.error("Fatal error:", exc_info=True)
+ pywikibot.error('Fatal error:', exc_info=True)

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iecde63ea817ee929daa2a4120ca22e2ec3c39f39
Gerrit-Change-Number: 462300
Gerrit-PatchSet: 2
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)