jenkins-bot has submitted this change and it was merged.
Change subject: Replace pywikibot.output(text, toStdout=True) with pywikibot.stdout(text) ......................................................................
Replace pywikibot.output(text, toStdout=True) with pywikibot.stdout(text)
toStdout parameter is maintained for backwards-compatibity only. Replace output with stdout.
Change-Id: I40600330700f3cb39619462f8372a0f22c8a9088 --- M scripts/category.py M scripts/cfd.py M scripts/listpages.py M scripts/reflinks.py M scripts/templatecount.py M scripts/watchlist.py 6 files changed, 24 insertions(+), 28 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py index 9fb3f62..b3281e0 100755 --- a/scripts/category.py +++ b/scripts/category.py @@ -109,8 +109,8 @@ # (C) leogregianin, 2004-2008 # (C) Ben McIlwain (CydeWeys), 2006-2015 # (C) Anreas J Schwab, 2007 -# (C) xqt, 2009-2015 -# (C) Pywikibot team, 2008-2015 +# (C) xqt, 2009-2016 +# (C) Pywikibot team, 2008-2016 # # Distributed under the terms of the MIT license. # @@ -1082,7 +1082,7 @@ f.write(tree) f.close() else: - pywikibot.output(tree, toStdout=True) + pywikibot.stdout(tree)
def main(*args): diff --git a/scripts/cfd.py b/scripts/cfd.py index 639252e..4655b57 100755 --- a/scripts/cfd.py +++ b/scripts/cfd.py @@ -13,7 +13,7 @@ """ # # (C) Ben McIlwain, 2008 -# (C) Pywikibot team, 2009-2013 +# (C) Pywikibot team, 2009-2016 # # Distributed under the terms of the MIT license. # @@ -143,7 +143,7 @@ pywikibot.Site(), dest, ns=14) if destpage.isCategoryRedirect(): summary = 'CANCELED. Destination is redirect: ' + summary - pywikibot.output(summary, toStdout=True) + pywikibot.stdout(summary) robot = None else: robot = CategoryMoveBot(oldcat=src, newcat=dest, batch=True, @@ -170,7 +170,7 @@ # so ignore it. pass if summary != "" and robot is not None: - pywikibot.output(summary, toStdout=True) + pywikibot.stdout(summary) # Run, robot, run! robot.run() summary = "" diff --git a/scripts/listpages.py b/scripts/listpages.py index cb3352c..f64e026 100755 --- a/scripts/listpages.py +++ b/scripts/listpages.py @@ -83,7 +83,7 @@ ¶ms; """ # -# (C) Pywikibot team, 2008-2014 +# (C) Pywikibot team, 2008-2016 # # Distributed under the terms of the MIT license. # @@ -255,7 +255,7 @@ pywikibot.stdout(output_list[-1]) if page_get: try: - pywikibot.output(page.text, toStdout=True) + pywikibot.stdout(page.text) except pywikibot.Error as err: pywikibot.output(err) if base_dir: diff --git a/scripts/reflinks.py b/scripts/reflinks.py index 5e9b913..0072ec0 100755 --- a/scripts/reflinks.py +++ b/scripts/reflinks.py @@ -445,8 +445,8 @@
def httpError(self, err_num, link, pagetitleaslink): """Log HTTP Error.""" - pywikibot.output(u'HTTP error (%s) for %s on %s' - % (err_num, link, pagetitleaslink), toStdout=True) + pywikibot.stdout('HTTP error ({0}) for {1} on {2}' + ''.format(err_num, link, pagetitleaslink))
def getPDFTitle(self, ref, f): """Use pdfinfo to retrieve title from a PDF. diff --git a/scripts/templatecount.py b/scripts/templatecount.py index f402d94..cb8ae24 100755 --- a/scripts/templatecount.py +++ b/scripts/templatecount.py @@ -64,20 +64,18 @@ @param namespaces: list of namespace numbers @type namespaces: list """ + FORMAT = '{0:<10}: {1:>5}' templateDict = cls.template_dict(templates, namespaces) - pywikibot.output(u'\nNumber of transclusions per template', - toStdout=True) - pywikibot.output(u'-' * 36, toStdout=True) + pywikibot.stdout('\nNumber of transclusions per template') + pywikibot.stdout('-' * 36) total = 0 for key in templateDict: count = len(templateDict[key]) - pywikibot.output(u'%-10s: %5d' % (key, count), - toStdout=True) + pywikibot.stdout(FORMAT.format(key, count)) total += count - pywikibot.output(u'TOTAL : %5d' % total, toStdout=True) - pywikibot.output(u'Report generated on %s' - % datetime.datetime.utcnow().isoformat(), - toStdout=True) + pywikibot.stdout(FORMAT.format('TOTAL', total)) + pywikibot.stdout('Report generated on {0}' + ''.format(datetime.datetime.utcnow().isoformat()))
@classmethod def listTemplates(cls, templates, namespaces): @@ -93,20 +91,18 @@ @type namespaces: list """ templateDict = cls.template_dict(templates, namespaces) - pywikibot.output(u'\nList of pages transcluding templates:', - toStdout=True) + pywikibot.stdout('\nList of pages transcluding templates:') for key in templates: pywikibot.output(u'* %s' % key) - pywikibot.output(u'-' * 36, toStdout=True) + pywikibot.stdout('-' * 36) total = 0 for key in templateDict: for page in templateDict[key]: - pywikibot.output(page.title(), toStdout=True) + pywikibot.stdout(page.title()) total += 1 pywikibot.output(u'Total page count: %d' % total) - pywikibot.output(u'Report generated on %s' - % datetime.datetime.utcnow().isoformat(), - toStdout=True) + pywikibot.stdout('Report generated on {0}' + ''.format(datetime.datetime.utcnow().isoformat()))
@classmethod def template_dict(cls, templates, namespaces): diff --git a/scripts/watchlist.py b/scripts/watchlist.py index 73a1ba7..9774c5d 100755 --- a/scripts/watchlist.py +++ b/scripts/watchlist.py @@ -17,7 +17,7 @@ """ # # (C) Daniel Herding, 2005 -# (C) Pywikibot team, 2005-2015 +# (C) Pywikibot team, 2005-2016 # # Distributed under the terms of the MIT license. # @@ -115,7 +115,7 @@ watchlist = refresh(site, sysop=sysop) pywikibot.output(u'%i pages in the watchlist.' % len(watchlist)) for page in watchlist: - pywikibot.output(page.title(), toStdout=True) + pywikibot.stdout(page.title())
if __name__ == "__main__": main()
pywikibot-commits@lists.wikimedia.org