def _save_blacklist(self): blpath = environ.homepath('plblacklist') bl = open(blpath, "w") try: bl.writelines( map('%s\n'.__mod__, self._blacklist)) finally: bl.close()
def appendBlacklist(node_ids): if not isinstance(node_ids, list): node_ids = [node_ids] blpath = environ.homepath('plblacklist') bl = open(blpath, "a") try: for node_id in node_ids: bl.write("%s\n" % (node_id, )) finally: bl.close()
def appendBlacklist(node_ids): if not isinstance(node_ids, list): node_ids = [ node_ids ] blpath = environ.homepath('plblacklist') bl = open(blpath, "a") try: for node_id in node_ids: bl.write("%s\n" % (node_id,)) finally: bl.close()
def filterBlacklist(candidates): blpath = environ.homepath('plblacklist') try: bl = open(blpath, "r") except: return candidates try: blacklist = set(map(int, map(str.strip, bl.readlines()))) return [x for x in candidates if x not in blacklist] finally: bl.close()
def _load_blacklist(self): blpath = environ.homepath('plblacklist') try: bl = open(blpath, "r") except: self._blacklist = set() return try: self._blacklist = set( map(str.strip, bl.readlines()) ) finally: bl.close()
def filterBlacklist(candidates): blpath = environ.homepath('plblacklist') try: bl = open(blpath, "r") except: return candidates try: blacklist = set( map(int, map(str.strip, bl.readlines()) ) ) return [ x for x in candidates if x not in blacklist ] finally: bl.close()