Whitelist tool update

This commit is contained in:
John 2015-06-09 18:46:16 +03:00 committed by Loudrob
parent 519a4fd111
commit 6b275d17db

View file

@ -38,6 +38,11 @@ def acceptWord():
acceptWord() acceptWord()
def removeDuplicates(list):
seen = set()
seen_add = seen.add
return [x for x in list if not (x in seen or seen_add(x))]
def saveChanges(): def saveChanges():
global LOCAL_LIST global LOCAL_LIST
print 'Saving the whitelist...' print 'Saving the whitelist...'
@ -46,11 +51,16 @@ def saveChanges():
f.write('WHITELIST = [\n') f.write('WHITELIST = [\n')
LOCAL_LIST.sort() LOCAL_LIST.sort()
LOCAL_LIST = list(set(LOCAL_LIST)) # Remove duplicates LOCAL_LIST = removeDuplicates(LOCAL_LIST)
addedWords = [] addedWords = []
for word in LOCAL_LIST: for word in LOCAL_LIST:
if word in addedWords:
if word in addedWords or word.contains('\\'):
continue
try:
word.decode('ascii')
except:
continue continue
addedWords.append(word) addedWords.append(word)