http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10496
Revision: 10496 Author: xqt Date: 2012-08-22 18:24:01 +0000 (Wed, 22 Aug 2012) Log Message: ----------- formatting output, update from trunk
Modified Paths: -------------- branches/rewrite/pywikibot/pagegenerators.py
Modified: branches/rewrite/pywikibot/pagegenerators.py =================================================================== --- branches/rewrite/pywikibot/pagegenerators.py 2012-08-22 17:19:19 UTC (rev 10495) +++ branches/rewrite/pywikibot/pagegenerators.py 2012-08-22 18:24:01 UTC (rev 10496) @@ -12,7 +12,7 @@ ¶ms; """ # -# (C) Pywikipedia bot team, 2008-2010 +# (C) Pywikipedia bot team, 2008-2012 # # Distributed under the terms of the MIT license. # @@ -737,7 +737,6 @@ seenPages[page] = True yield page
- def RegexFilterPageGenerator(generator, regex): """Yield pages from another generator whose titles match regex.""" reg = re.compile(regex, re.I) @@ -1087,7 +1086,6 @@ for day in xrange(1, date.getNumberOfDaysInMonth(month)+1): yield pywikibot.Page(pywikibot.Link(fd(month, day), site))
- def main(*args): try: gen = None @@ -1096,8 +1094,10 @@ genFactory.handleArg(arg) gen = genFactory.getCombinedGenerator() if gen: + i = 0 for page in gen: - pywikibot.stdout(page.title()) + i += 1 + pywikibot.stdout("%4d: %s" % (i, page.title())) else: pywikibot.showHelp() except Exception:
pywikipedia-svn@lists.wikimedia.org