create namedtuple with default mapping
authorPavlos Ratis <dastergon@gentoo.org>
Thu, 22 May 2014 16:21:17 +0000 (19:21 +0300)
committerPavlos Ratis <dastergon@gentoo.org>
Sat, 24 May 2014 17:38:48 +0000 (20:38 +0300)
gkeys/config.py
gkeys/seed.py

index 818f5b1282197641a867c986b68d0ccb66bb6033..b20d5cdc0321f0ac6af330a42325096077a01563 100644 (file)
@@ -184,20 +184,6 @@ class GKEY(namedtuple('GKEY', ['nick', 'name', 'keyid', 'longkeyid',
                 result = data.split(self.list_separator)
         return result
 
-    def _unpack_dict(self, data):
-        values = []
-        for attr in self._fields:
-            values.append(data[attr])
-        return values
-
-    def make_packed_dict(self, packed_dict):
-        '''Creates a new instance of Gkey from a dictionary
-
-        @param packed_dict: data inside a dictionary
-        @return new GKEY instance containing the data
-        '''
-        return GKEY._make(self._unpack_dict(packed_dict))
-
     def make_packed(self, packed_string):
         '''Creates a new instance of Gkey from the packed
         value string
index aebf63df75fc57c42ecfa0060db615d28a04571e..ecbbf835f0295b7bcafa47a2c338342569aa4dd4 100644 (file)
@@ -52,11 +52,9 @@ class Seeds(object):
             logger.debug("Seed: load; IOError occurred while loading file")
             self._error(err)
             return False
-        # initialize a dummy instance, so it can make new ones
-        gkey = GKEY._make([None,None,None,None,None,None])
         for seed in seedlines.items():
             #try:
-            self.seeds.append(gkey.make_packed_dict(seed[1]))
+            self.seeds.append(GKEY(**seed[1]))
             #except Exception as err:
                 #logger.debug("Seed: load; Error splitting seed: %s" % seed)
                 #logger.debug("Seed: load; ...............parts: %s" % str(parts))