Example #1
0
 def _save_blacklist(self):
     blpath = environ.homepath('plblacklist')
     bl = open(blpath, "w")
     try:
         bl.writelines(
             map('%s\n'.__mod__, self._blacklist))
     finally:
         bl.close()
Example #2
0
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()
Example #3
0
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()
Example #4
0
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()
Example #5
0
 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()
Example #6
0
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()