From: W. Trevor King Date: Fri, 20 Dec 2013 21:13:19 +0000 (-0800) Subject: Allow explicit types in PGPPacket._clean_type X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=529228b2199cafe7d8398bbc302f16183c7bfe92;p=gpg-migrate.git Allow explicit types in PGPPacket._clean_type This will let me use it to clean the signature subpacket type for parsing signature subpackets. --- diff --git a/gpg-migrate.py b/gpg-migrate.py index 08ba424..515760b 100755 --- a/gpg-migrate.py +++ b/gpg-migrate.py @@ -235,8 +235,10 @@ class PGPPacket (dict): _clean_type_regex = _re.compile('\W+') - def _clean_type(self): - return self._clean_type_regex.sub('_', self['type']) + def _clean_type(self, type=None): + if type is None: + type = self['type'] + return self._clean_type_regex.sub('_', type) def __str__(self): method_name = '_str_{}'.format(self._clean_type())