[Pywikipedia-l] SVN: [6282] trunk/pywikipedia/interwiki.py

purodha at svn.wikimedia.org purodha at svn.wikimedia.org
Fri Jan 23 14:15:11 UTC 2009


Revision: 6282
Author:   purodha
Date:     2009-01-23 14:15:11 +0000 (Fri, 23 Jan 2009)

Log Message:
-----------
Save some memora and file handles by deleting page generators after -xxfile: parameter processing.
Add -hintfile parameter, see https://sourceforge.net/tracker2/?func=detail&aid=2284955&group_id=93107&atid=603141

Modified Paths:
--------------
    trunk/pywikipedia/interwiki.py

Modified: trunk/pywikipedia/interwiki.py
===================================================================
--- trunk/pywikipedia/interwiki.py	2009-01-23 13:39:53 UTC (rev 6281)
+++ trunk/pywikipedia/interwiki.py	2009-01-23 14:15:11 UTC (rev 6282)
@@ -91,6 +91,9 @@
                        * latin:   All languages using the Latin script.
                        * scand:   All Scandinavian languages.
 
+    -hintfile:     similar to -hint, except that the hints are taken from
+                   the given file, one per line, instead of the command line.
+
     -askhints:     for each page one or more hints are asked. See hint: above
                    for the format, one can for example give "en:something" or
                    "20:" as hint.
@@ -1612,6 +1615,12 @@
                 globalvar.auto = False
             elif arg.startswith('-hint:'):
                 hints.append(arg[6:])
+            elif arg.startswith('-hintfile:'):
+                hintfile = arg[10:]
+                hintPageGen = pagegenerators.TextfilePageGenerator(hintfile)
+                for page in hintPageGen:
+                    hints.append(page)
+                del hintPageGen
             elif arg == '-force':
                 globalvar.force = True
             elif arg == '-same':
@@ -1687,6 +1696,7 @@
                 skipPageGen = pagegenerators.TextfilePageGenerator(skipfile)
                 for page in skipPageGen:
                     globalvar.skip.add(page)
+                del skipPageGen
             elif arg == '-skipauto':
                 globalvar.skipauto = True
             elif arg == '-restore':
@@ -1710,6 +1720,7 @@
                 ignorePageGen = pagegenerators.TextfilePageGenerator(ignorefile)
                 for page in ignorePageGen:
                     globalvar.ignore.append(page)
+                del ignorePageGen
             elif arg == '-showpage':
                 globalvar.showtextlink += globalvar.showtextlinkadd
             elif arg == '-graph':





More information about the Pywikipedia-l mailing list