jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/462209 )
Change subject: [cleanup] cleanup wikisourcetext.py ......................................................................
[cleanup] cleanup wikisourcetext.py
- use single quotes for string constants - keep lines beneath 80 chars - use str.format() instead of modulo operator for changed lines
Inspired from Xqt's work here: I75587eede55fc487.
Change-Id: Ifa48942772339903e51f672bf1a7f1831f1b4911 --- M scripts/wikisourcetext.py 1 file changed, 10 insertions(+), 7 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/wikisourcetext.py b/scripts/wikisourcetext.py index 4e2151f..2daacfb 100644 --- a/scripts/wikisourcetext.py +++ b/scripts/wikisourcetext.py @@ -103,8 +103,8 @@ @raises: pywikibot.Error """ if not isinstance(page, ProofreadPage): - raise pywikibot.Error('Page %s must be a ProofreadPage object.' - % page) + raise pywikibot.Error('Page {} must be a ProofreadPage object.' + .format(page))
summary = self.getOption('summary')
@@ -118,7 +118,8 @@
if (page.exists() and not (self.getOption('ocr') and self.getOption('force'))): - pywikibot.output('Page %s already exists, not adding!' % page) + pywikibot.output('Page {} already exists, not adding!' + .format(page)) else: self.userPut(page, old_text, page.text, summary=summary, show_diff=self.getOption('showdiff')) @@ -156,7 +157,7 @@ elif arg == '-always': options['always'] = True else: - pywikibot.output('Unknown argument %s' % arg) + pywikibot.output('Unknown argument ' + arg)
# index is mandatory. if not index: @@ -170,13 +171,14 @@
site = pywikibot.Site() if not site.has_extension('ProofreadPage'): - pywikibot.error('Site %s must have ProofreadPage extension.' % site) + pywikibot.error('Site {} must have ProofreadPage extension.' + .format(site)) return False
index = IndexPage(site, index)
if not index.exists(): - pywikibot.error("Page %s doesn't exist." % index) + pywikibot.error("Page {} doesn't exist.".format(index)) return False
# Parse pages param. @@ -200,7 +202,8 @@
gen = itertools.chain(*gen_list)
- pywikibot.output('\nUploading text to %s\n' % index.title(as_link=True)) + pywikibot.output('\nUploading text to {}\n' + .format(index.title(as_link=True)))
bot = UploadTextBot(gen, site=index.site, **options) bot.run()
pywikibot-commits@lists.wikimedia.org