Revision: 6702 Author: nicdumz Date: 2009-04-25 08:45:33 +0000 (Sat, 25 Apr 2009)
Log Message: ----------- openSites() : do not create a dict if not necessary
Modified Paths: -------------- trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py =================================================================== --- trunk/pywikipedia/interwiki.py 2009-04-25 08:35:16 UTC (rev 6701) +++ trunk/pywikipedia/interwiki.py 2009-04-25 08:45:33 UTC (rev 6702) @@ -650,16 +650,12 @@
def openSites(self): """ - Return a dictionary, where keys are sites where we - still have work to do on, and values are the number - of items in that Site that needs work on + Iterator. Yields (site, count) pairs: + * site is a site where we still have work to do on + * count is the number of items in that Site that need work on """ - siteCount = {} + return self.todo.siteCounts()
- for site, count in self.todo.siteCounts(): - siteCount[site] = count - return siteCount - def willWorkOn(self, site): """ By calling this method, you 'promise' this instance that you will @@ -1476,7 +1472,7 @@ """Add a single subject to the list""" subj = Subject(page, hints = hints) self.subjects.append(subj) - for site, count in subj.openSites().iteritems(): + for site, count in subj.openSites(): # Keep correct counters self.plus(site, count)
@@ -1549,7 +1545,7 @@ maxlang = None if not self.firstSubject(): return None - oc = self.firstSubject().openSites() + oc = dict(self.firstSubject().openSites()) if not oc: # The first subject is done. This might be a recursive call made because we # have to wait before submitting another modification to go live. Select