From ce2e55e90c5f6138cb43d8ebd8119733d2a50273 Mon Sep 17 00:00:00 2001 From: "Piotr F. Mieszkowski" Date: Fri, 15 Jul 2022 17:40:57 +0200 Subject: [PATCH] Change indentation from tabs to 4 spaces --- lacre/text.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lacre/text.py b/lacre/text.py index 17baaa7..1314f74 100644 --- a/lacre/text.py +++ b/lacre/text.py @@ -8,28 +8,28 @@ PGP_INLINE_BEGIN = b"-----BEGIN PGP MESSAGE-----" PGP_INLINE_END = b"-----END PGP MESSAGE-----" def parse_content_type(content_type): - parts = [p.strip() for p in content_type.split(';')] - if len(parts) == 1: - # No additional attributes provided. Use default encoding. - return (content_type, sys.getdefaultencoding()) + parts = [p.strip() for p in content_type.split(';')] + if len(parts) == 1: + # No additional attributes provided. Use default encoding. + return (content_type, sys.getdefaultencoding()) - # At least one attribute provided. Find out if any of them is named - # 'charset' and if so, use it. - ctype = parts[0] - encoding = [p for p in parts[1:] if p.startswith('charset=') ] - if encoding: - eq_idx = encoding[0].index('=') - return (ctype, encoding[0][eq_idx+1:]) - else: - return (ctype, sys.getdefaultencoding()) + # At least one attribute provided. Find out if any of them is named + # 'charset' and if so, use it. + ctype = parts[0] + encoding = [p for p in parts[1:] if p.startswith('charset=') ] + if encoding: + eq_idx = encoding[0].index('=') + return (ctype, encoding[0][eq_idx+1:]) + else: + return (ctype, sys.getdefaultencoding()) def parse_delimiter(address): - withdelim = re.match('^([^\+]+)\+([^@]+)@(.*)$', address) - if withdelim: - return (withdelim.group(1) + '@' + withdelim.group(3), withdelim.group(2)) - else: - return (address, None) + withdelim = re.match('^([^\+]+)\+([^@]+)@(.*)$', address) + if withdelim: + return (withdelim.group(1) + '@' + withdelim.group(3), withdelim.group(2)) + else: + return (address, None) def is_pgp_inline(payload): - """Finds out if the payload (bytes) contains PGP/INLINE markers.""" - return PGP_INLINE_BEGIN in payload and PGP_INLINE_END in payload + """Finds out if the payload (bytes) contains PGP/INLINE markers.""" + return PGP_INLINE_BEGIN in payload and PGP_INLINE_END in payload