Revision: 6715 Author: nicdumz Date: 2009-04-25 14:51:44 +0000 (Sat, 25 Apr 2009)
Log Message: ----------- Using set difference instead of a for + inner test on each element
Modified Paths: -------------- trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py =================================================================== --- trunk/pywikipedia/interwiki.py 2009-04-25 14:43:14 UTC (rev 6714) +++ trunk/pywikipedia/interwiki.py 2009-04-25 14:51:44 UTC (rev 6715) @@ -1426,8 +1426,9 @@ expectedPages = set(new.itervalues()) expectedSites = set(new) try: - for site, page in new.iteritems(): - if site not in updatedSites and not page.section(): + for site in expectedSites - updatedSites: + page = new[site] + if not page.section(): try: linkedPages = set(page.interwiki()) except wikipedia.NoPage: @@ -1438,8 +1439,8 @@ linkedPagesDict = {} for linkedPage in linkedPages: linkedPagesDict[linkedPage.site()] = linkedPage - for expectedPage in expectedPages: - if expectedPage != page and expectedPage not in linkedPages: + for expectedPage in expectedPages - linkedPages: + if expectedPage != page: try: linkedPage = linkedPagesDict[expectedPage.site()] wikipedia.output(u"WARNING: %s: %s does not link to %s but to %s" % (page.site().family.name, page.aslink(True), expectedPage.aslink(True), linkedPage.aslink(True)))
pywikipedia-svn@lists.wikimedia.org