From 529228b2199cafe7d8398bbc302f16183c7bfe92 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" <wking@tremily.us> Date: Fri, 20 Dec 2013 13:13:19 -0800 Subject: [PATCH] Allow explicit types in PGPPacket._clean_type This will let me use it to clean the signature subpacket type for parsing signature subpackets. --- gpg-migrate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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()) -- 2.26.2