jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/462698 )
Change subject: [cleanup] cleanup scripts/djvutext.py ......................................................................
[cleanup] cleanup scripts/djvutext.py
- use str.format(...) instead of modulo for type specifier arguments - use "+" to concatenate strings in some cases
Change-Id: I45e86cfdfbb625be5ab64c8a12f0e398a3049f41 --- M scripts/djvutext.py 1 file changed, 11 insertions(+), 8 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/djvutext.py b/scripts/djvutext.py index 1ede95a..1c0a5d4 100644 --- a/scripts/djvutext.py +++ b/scripts/djvutext.py @@ -117,8 +117,9 @@ summary = self.getOption('summary') if page.exists() and not self.getOption('force'): pywikibot.output( - 'Page %s already exists, not adding!\n' - 'Use -force option to overwrite the output page.' % page) + 'Page {} already exists, not adding!\n' + 'Use -force option to overwrite the output page.' + .format(page)) else: self.userPut(page, old_text, new_text, summary=summary)
@@ -153,7 +154,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: @@ -164,7 +165,7 @@ djvu_path = os.path.expanduser(djvu_path) djvu_path = os.path.abspath(djvu_path) if not os.path.exists(djvu_path): - pywikibot.error('No such file or directory: %s' % djvu_path) + pywikibot.error('No such file or directory: ' + djvu_path) return False if os.path.isdir(djvu_path): djvu_path = os.path.join(djvu_path, index) @@ -173,7 +174,8 @@ djvu = DjVuFile(djvu_path)
if not djvu.has_text(): - pywikibot.error('No text layer in djvu file %s' % djvu.file_djvu) + pywikibot.error('No text layer in djvu file {}' + .format(djvu.file_djvu)) return False
# Parse pages param. @@ -189,7 +191,8 @@
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_page = pywikibot.Page(site, index, ns=site.proofread_index_ns) @@ -197,8 +200,8 @@ if not index_page.exists(): raise pywikibot.NoPage(index)
- pywikibot.output('uploading text from %s to %s' - % (djvu.file_djvu, index_page.title(as_link=True))) + pywikibot.output('uploading text from {} to {}' + .format(djvu.file_djvu, index_page.title(as_link=True)))
bot = DjVuTextBot(djvu, index_page, pages, **options) bot.run()
pywikibot-commits@lists.wikimedia.org