From: Pavlos Ratis Date: Mon, 26 May 2014 19:25:34 +0000 (+0300) Subject: remove unused GKEY code X-Git-Url: http://git.tremily.us/?p=gentoo-keys.git;a=commitdiff_plain;h=bf526d025a101b3ee8999acbc98ad90ae4c603dc remove unused GKEY code --- diff --git a/gkeyldap/actions.py b/gkeyldap/actions.py index 7c0608b..3de4308 100644 --- a/gkeyldap/actions.py +++ b/gkeyldap/actions.py @@ -14,7 +14,6 @@ import os import re from collections import defaultdict -from gkeys.config import GKEY from gkeys.seed import Seeds from gkeyldap.search import (LdapSearch, UID, gkey2ldap_map, gkey2SEARCH) diff --git a/gkeyldap/search.py b/gkeyldap/search.py index 5f2ffbd..c19a088 100644 --- a/gkeyldap/search.py +++ b/gkeyldap/search.py @@ -15,7 +15,6 @@ except ImportError: from gkeys import log -from gkeys.config import GKEY logger = log.logger diff --git a/gkeys/config.py b/gkeys/config.py index b932fb2..14756e7 100644 --- a/gkeys/config.py +++ b/gkeys/config.py @@ -114,66 +114,6 @@ class GKeysConfig(GPGConfig): class GKEY(namedtuple('GKEY', ['nick', 'name', 'keydir', 'fingerprint'])): '''Class to hold the relavent info about a key''' - field_types = {'nick': str, 'name': str, 'keyid': list, - 'longkeyid': list, 'keydir': str, 'fingerprint': list} - field_separator = "|" - list_separator = ":" + 'longkeyid': list, 'keydir': str, 'fingerprint': list} __slots__ = () - - def _packed_values(self): - '''Returns a list of the field values''' - v = [] - for f in self._fields: - v.append(self._pack(f)) - return v - - @property - def packed_string(self): - '''Returns a separator joined string of the field values''' - return self.field_separator.join([str(x) for x in self._packed_values()]) - - def _unpack_string(self, packed_data): - '''Returns a list of the separator joined string of the field values''' - values = [] - data = packed_data.split(self.field_separator) - for x in self._fields: - values.append(self._unpack(x, data.pop(0))) - return values - - def _pack(self, field): - '''pack field data into a string''' - if self.field_types[field] == str: - return getattr(self, field) - elif self.field_types[field] == list: - info = getattr(self, field) - if info: - return self.list_separator.join(info) - else: - # force an empty list to None - return 'None' - else: - raise "ERROR packing %s" %str(getattr(self, field)) - - def _unpack(self, field, data): - '''unpack field data to the desired type''' - if self.field_types[field] == str: - result = data - if result == 'None': - result = None - else: - if data == 'None': - # make it an empty list - result = [] - else: - result = data.split(self.list_separator) - return result - - def make_packed(self, packed_string): - '''Creates a new instance of Gkey from the packed - value string - - @param packed_string: string of data separated by field_separator - @return new GKEY instance containing the data - ''' - return GKEY._make(self._unpack_string(packed_string))