[projects/pld-builder.new] rewrite Blacklist_File with set

draenog draenog at pld-linux.org
Mon Jun 24 03:21:39 CEST 2013


commit aeaf1b73b36ef2bb4d14a682279aeeb512719088
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Mon Jun 24 01:13:09 2013 +0100

    rewrite Blacklist_File with set

 PLD_Builder/blacklist.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/PLD_Builder/blacklist.py b/PLD_Builder/blacklist.py
index 54cc66b..fa20723 100644
--- a/PLD_Builder/blacklist.py
+++ b/PLD_Builder/blacklist.py
@@ -26,20 +26,20 @@ class Blacklist_File:
 
     def reload(self):
         self.blacklist_file_mtime = os.stat(path.blacklist_file)[stat.ST_MTIME]
-        self.blacklist = {}
+        self.blacklist = set()
         status.push("reading package-blacklist")
         with open(path.blacklist_file) as f:
             for l in f:
                 p = l.rstrip()
                 if re.match(r"^#.*", p):
                     continue
-                self.blacklist[p] = 1
-                log.notice("blacklist added: %s (%d)" % (l, self.blacklist.has_key(p)))
+                self.blacklist.add(p)
+                log.notice("blacklist added: %s" % l)
         status.pop()
 
     def package(self, p):
 #       log.notice("blacklist check: %s (%d)" % (p, self.blacklist.has_key(p)))
-        if self.blacklist.has_key(p):
+        if p in self.blacklist:
             return True
         return False
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/aeaf1b73b36ef2bb4d14a682279aeeb512719088



More information about the pld-cvs-commit mailing list