http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9661
Revision: 9661
Author: xqt
Date: 2011-10-24 14:43:26 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
lookahead parameter is no longer used by PreloadingGenerator since 2008; decorate it as deprecated_arg and remove it from parameter list.
Modified Paths:
--------------
trunk/pywikipedia/pagegenerators.py
trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/pagegenerators.py
===================================================================
--- trunk/pywikipedia/pagegenerators.py 2011-10-24 12:53:32 UTC (rev 9660)
+++ trunk/pywikipedia/pagegenerators.py 2011-10-24 14:43:26 UTC (rev 9661)
@@ -21,6 +21,7 @@
__version__='$Id$'
import wikipedia as pywikibot
+from pywikibot import deprecate_arg
import config
import traceback
@@ -1171,11 +1172,10 @@
Operates asynchronously, so the next batch of pages is loaded in the
background before the first batch is fully consumed.
"""
- def __init__(self, generator, pageNumber=60, lookahead=10):
+ @deprecate_arg("lookahead", None)
+ def __init__(self, generator, pageNumber=60):
self.wrapped_gen = generator
self.pageNumber = pageNumber
-# ThreadedGenerator.__init__(self, name="Preloading-Thread",
-# qsize=lookahead)
def __iter__(self):
try:
@@ -1183,8 +1183,6 @@
# after these pages have been preloaded and yielded.
somePages = []
for page in self.wrapped_gen:
-## if self.finished.isSet():
-## return
somePages.append(page)
# We don't want to load too many pages at once using XML export.
# We only get a maximum number at a time.
Modified: trunk/pywikipedia/replace.py
===================================================================
--- trunk/pywikipedia/replace.py 2011-10-24 12:53:32 UTC (rev 9660)
+++ trunk/pywikipedia/replace.py 2011-10-24 14:43:26 UTC (rev 9661)
@@ -806,15 +806,10 @@
# syntax error, show help text from the top of this file
pywikibot.showHelp('replace')
return
- if xmlFilename:
- # XML parsing can be quite slow, so use smaller batches and
- # longer lookahead.
- preloadingGen = pagegenerators.PreloadingGenerator(gen,
- pageNumber=20, lookahead=100)
- else:
- preloadingGen = pagegenerators.PreloadingGenerator(gen,
- pageNumber=maxquerysize)
+ preloadingGen = pagegenerators.PreloadingGenerator(gen,
+ pageNumber=maxquerysize)
+
#Finally we open the file for page titles or set article to None
if filename:
try:
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9660
Revision: 9660
Author: xqt
Date: 2011-10-24 12:53:32 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
Revert r9659 (I was confusion right and left side of my working copy)
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2011-10-24 10:09:10 UTC (rev 9659)
+++ trunk/pywikipedia/wikipedia.py 2011-10-24 12:53:32 UTC (rev 9660)
@@ -36,7 +36,7 @@
put_throttle: Call to limit rate of write-access to wiki
Other functions:
- getall(): Load a group of pages via Special:Export
+ getall(): Load a group of pages
handleArgs(): Process all standard command line arguments (such as
-family, -lang, -log and others)
translate(xx, dict): dict is a dictionary, giving text depending on
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9659
Revision: 9659
Author: xqt
Date: 2011-10-24 10:09:10 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
update doc
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2011-10-24 09:38:49 UTC (rev 9658)
+++ trunk/pywikipedia/wikipedia.py 2011-10-24 10:09:10 UTC (rev 9659)
@@ -36,7 +36,7 @@
put_throttle: Call to limit rate of write-access to wiki
Other functions:
- getall(): Load a group of pages
+ getall(): Load a group of pages via Special:Export
handleArgs(): Process all standard command line arguments (such as
-family, -lang, -log and others)
translate(xx, dict): dict is a dictionary, giving text depending on