Revision: 5543 Author: cosoleto Date: 2008-06-09 10:09:43 +0000 (Mon, 09 Jun 2008)
Log Message: ----------- code cleanup
Modified Paths: -------------- trunk/pywikipedia/diskcache.py trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/diskcache.py =================================================================== --- trunk/pywikipedia/diskcache.py 2008-06-09 09:57:40 UTC (rev 5542) +++ trunk/pywikipedia/diskcache.py 2008-06-09 10:09:43 UTC (rev 5543) @@ -2,6 +2,7 @@ import config import sys import os + # http://mail.python.org/pipermail/python-list/2006-March/375280.html try: os.SEEK_SET @@ -23,7 +24,7 @@ if not os.path.exists(self.cache_path): break self.cache_file = open(self.cache_path, 'wb+')
- lookup = [-1 for i in xrange(36)] + lookup = [-1] * 36 data.sort(key = lambda i: i[0]) for key, value in data: if type(key) is unicode: @@ -36,7 +37,7 @@ raise RuntimeError('Only alphabetic keys are supported', key)
if index < 'a': - index = ord(index) - 48 + 26# Numeric + index = ord(index) - 48 + 26 # Numeric else: index = ord(index) - 97 if lookup[index] == -1: @@ -79,7 +80,7 @@ if index < 'a': if index < '0' or index > '9': raise KeyError(key) - i = ord(index) - 48 + 26# Numeric + i = ord(index) - 48 + 26 # Numeric else: if index > 'z': raise KeyError(key)
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-06-09 09:57:40 UTC (rev 5542) +++ trunk/pywikipedia/wikipedia.py 2008-06-09 10:09:43 UTC (rev 5543) @@ -2624,7 +2624,7 @@ titleList = re.search('(?s)<h2 id="filelinks">.+?<!-- end content -->', self.getImagePageHtml()).group() lineR = re.compile( - '<li><a href="[^"]+?" title=".+?">(?P<title>.+?)</a></li>') + '<li><a href="[^"]+" title=".+?">(?P<title>.+?)</a></li>')
for match in lineR.finditer(titleList): try: