Cosmetics

This commit is contained in:
Bernardo Damele 2011-01-07 16:50:39 +00:00
parent c17714c423
commit e373dac1f2

View File

@ -1371,7 +1371,9 @@ def getFileItems(filename, commentPrefix='#', unicode_=True, lowercase=False, un
if commentPrefix: if commentPrefix:
if line.find(commentPrefix) != -1: if line.find(commentPrefix) != -1:
line = line[:line.find(commentPrefix)] line = line[:line.find(commentPrefix)]
line = line.strip() line = line.strip()
if not unicode_: if not unicode_:
try: try:
line = str.encode(line) line = str.encode(line)
@ -1380,8 +1382,10 @@ def getFileItems(filename, commentPrefix='#', unicode_=True, lowercase=False, un
if line: if line:
if lowercase: if lowercase:
line = line.lower() line = line.lower()
if unique and line in retVal: if unique and line in retVal:
continue continue
retVal.append(line) retVal.append(line)
return retVal return retVal
@ -1958,10 +1962,10 @@ def filterListValue(value, regex):
if regex: if regex:
retVal = [] retVal = []
filter = getCompiledRegex(regex, re.I) filt = getCompiledRegex(regex, re.I)
for word in value: for word in value:
if filter.search(word): if filt.search(word):
retVal.append(word) retVal.append(word)
return retVal return retVal