Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeyldap/, gkeys/
Date: Tue, 27 May 2014 20:56:55
Message-Id: 1401132334.bf526d025a101b3ee8999acbc98ad90ae4c603dc.dol-sen@gentoo
1 commit: bf526d025a101b3ee8999acbc98ad90ae4c603dc
2 Author: Pavlos Ratis <dastergon <AT> gentoo <DOT> org>
3 AuthorDate: Mon May 26 19:25:34 2014 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Mon May 26 19:25:34 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=bf526d02
7
8 remove unused GKEY code
9
10 ---
11 gkeyldap/actions.py | 1 -
12 gkeyldap/search.py | 1 -
13 gkeys/config.py | 62 +----------------------------------------------------
14 3 files changed, 1 insertion(+), 63 deletions(-)
15
16 diff --git a/gkeyldap/actions.py b/gkeyldap/actions.py
17 index 7c0608b..3de4308 100644
18 --- a/gkeyldap/actions.py
19 +++ b/gkeyldap/actions.py
20 @@ -14,7 +14,6 @@ import os
21 import re
22
23 from collections import defaultdict
24 -from gkeys.config import GKEY
25 from gkeys.seed import Seeds
26 from gkeyldap.search import (LdapSearch, UID, gkey2ldap_map, gkey2SEARCH)
27
28
29 diff --git a/gkeyldap/search.py b/gkeyldap/search.py
30 index 5f2ffbd..c19a088 100644
31 --- a/gkeyldap/search.py
32 +++ b/gkeyldap/search.py
33 @@ -15,7 +15,6 @@ except ImportError:
34
35
36 from gkeys import log
37 -from gkeys.config import GKEY
38
39 logger = log.logger
40
41
42 diff --git a/gkeys/config.py b/gkeys/config.py
43 index b932fb2..14756e7 100644
44 --- a/gkeys/config.py
45 +++ b/gkeys/config.py
46 @@ -114,66 +114,6 @@ class GKeysConfig(GPGConfig):
47 class GKEY(namedtuple('GKEY', ['nick', 'name', 'keydir', 'fingerprint'])):
48 '''Class to hold the relavent info about a key'''
49
50 -
51 field_types = {'nick': str, 'name': str, 'keyid': list,
52 - 'longkeyid': list, 'keydir': str, 'fingerprint': list}
53 - field_separator = "|"
54 - list_separator = ":"
55 + 'longkeyid': list, 'keydir': str, 'fingerprint': list}
56 __slots__ = ()
57 -
58 - def _packed_values(self):
59 - '''Returns a list of the field values'''
60 - v = []
61 - for f in self._fields:
62 - v.append(self._pack(f))
63 - return v
64 -
65 - @property
66 - def packed_string(self):
67 - '''Returns a separator joined string of the field values'''
68 - return self.field_separator.join([str(x) for x in self._packed_values()])
69 -
70 - def _unpack_string(self, packed_data):
71 - '''Returns a list of the separator joined string of the field values'''
72 - values = []
73 - data = packed_data.split(self.field_separator)
74 - for x in self._fields:
75 - values.append(self._unpack(x, data.pop(0)))
76 - return values
77 -
78 - def _pack(self, field):
79 - '''pack field data into a string'''
80 - if self.field_types[field] == str:
81 - return getattr(self, field)
82 - elif self.field_types[field] == list:
83 - info = getattr(self, field)
84 - if info:
85 - return self.list_separator.join(info)
86 - else:
87 - # force an empty list to None
88 - return 'None'
89 - else:
90 - raise "ERROR packing %s" %str(getattr(self, field))
91 -
92 - def _unpack(self, field, data):
93 - '''unpack field data to the desired type'''
94 - if self.field_types[field] == str:
95 - result = data
96 - if result == 'None':
97 - result = None
98 - else:
99 - if data == 'None':
100 - # make it an empty list
101 - result = []
102 - else:
103 - result = data.split(self.list_separator)
104 - return result
105 -
106 - def make_packed(self, packed_string):
107 - '''Creates a new instance of Gkey from the packed
108 - value string
109 -
110 - @param packed_string: string of data separated by field_separator
111 - @return new GKEY instance containing the data
112 - '''
113 - return GKEY._make(self._unpack_string(packed_string))