PEP8 cleanups, style cleanups, unused imports

This commit is contained in:
Roberto Rosario
2012-01-18 13:52:19 -04:00
parent 1a285d56dc
commit 8a5d0425b6
42 changed files with 311 additions and 335 deletions

View File

@@ -9,28 +9,28 @@ def accept_item(value, whitelist, blacklist, default_accept=True):
"""
return true if this item is either whitelisted or
not blacklisted
"""
"""
if not whitelist:
whitelist = []
if not blacklist:
blacklist = []
# note the order
for reject, item_list in ([False, whitelist], [True, blacklist]):
# note the order
for reject, item_list in ([False, whitelist], [True, blacklist]):
#print 'item_list: %s' % item_list
#print 'reject: %s' % reject
for okpattern in item_list:
#print 'okpattern: %s' % okpattern
if re.findall(okpattern.replace('*', '\S+'), value, re.I):
# match!
if re.findall(okpattern.replace('*', '\S+'), value, re.I):
# match!
#print 'MATCH'
if reject:
return False
else:
if reject:
return False
else:
return True
# default is to accept all
# default is to accept all
return default_accept