sequenial-blacklist: Properly read the local file

This commit is contained in:
Anthony Castelli 2014-08-29 11:43:59 -07:00
parent de0d0cafc5
commit c4b994a947
2 changed files with 5 additions and 5 deletions

View file

@ -2,12 +2,12 @@ class SequenceList:
def __init__(self, wordlist): def __init__(self, wordlist):
self.list = {} self.list = {}
for line in wordlist.split('\r\n'): for line in wordlist:
if line is '': if line is '':
continue continue
split = line.split(':') split = line.split(':')
self.list[split[0].lower()] = [word.rstrip('\r\n').lower() for word in split[1].split(',')] self.list[split[0].lower()] = [word.rstrip('\r\n').lower() for word in split[1].split(',')]
def getList(self, word): def getList(self, word):
if word in self.list: if word in self.list:
return self.list[word] return self.list[word]

View file

@ -21,7 +21,7 @@ class TTSequenceList(SequenceList):
doc = self.ch.getDocumentSpec() doc = self.ch.getDocumentSpec()
self.ch.getDocument(doc) self.ch.getDocument(doc)
self.ch.downloadToRam(fs) self.ch.downloadToRam(fs)
return fs.getData() return fs.getData().split('\r\n')
def loadSquencesLocally(self): def loadSquencesLocally(self):
vfs = VirtualFileSystem.getGlobalPtr() vfs = VirtualFileSystem.getGlobalPtr()
@ -32,5 +32,5 @@ class TTSequenceList(SequenceList):
if not found: if not found:
self.notify.warning("Couldn't find blacklist sequence data file!") self.notify.warning("Couldn't find blacklist sequence data file!")
return return
data = vfs.readFile(filename, 1) data = vfs.readFile(filename, True)
return data return data.split('\n')