Change indentation from tabs to 4 spaces
This commit is contained in:
parent
0cb656f89d
commit
ce2e55e90c
|
@ -8,28 +8,28 @@ PGP_INLINE_BEGIN = b"-----BEGIN PGP MESSAGE-----"
|
||||||
PGP_INLINE_END = b"-----END PGP MESSAGE-----"
|
PGP_INLINE_END = b"-----END PGP MESSAGE-----"
|
||||||
|
|
||||||
def parse_content_type(content_type):
|
def parse_content_type(content_type):
|
||||||
parts = [p.strip() for p in content_type.split(';')]
|
parts = [p.strip() for p in content_type.split(';')]
|
||||||
if len(parts) == 1:
|
if len(parts) == 1:
|
||||||
# No additional attributes provided. Use default encoding.
|
# No additional attributes provided. Use default encoding.
|
||||||
return (content_type, sys.getdefaultencoding())
|
return (content_type, sys.getdefaultencoding())
|
||||||
|
|
||||||
# At least one attribute provided. Find out if any of them is named
|
# At least one attribute provided. Find out if any of them is named
|
||||||
# 'charset' and if so, use it.
|
# 'charset' and if so, use it.
|
||||||
ctype = parts[0]
|
ctype = parts[0]
|
||||||
encoding = [p for p in parts[1:] if p.startswith('charset=') ]
|
encoding = [p for p in parts[1:] if p.startswith('charset=') ]
|
||||||
if encoding:
|
if encoding:
|
||||||
eq_idx = encoding[0].index('=')
|
eq_idx = encoding[0].index('=')
|
||||||
return (ctype, encoding[0][eq_idx+1:])
|
return (ctype, encoding[0][eq_idx+1:])
|
||||||
else:
|
else:
|
||||||
return (ctype, sys.getdefaultencoding())
|
return (ctype, sys.getdefaultencoding())
|
||||||
|
|
||||||
def parse_delimiter(address):
|
def parse_delimiter(address):
|
||||||
withdelim = re.match('^([^\+]+)\+([^@]+)@(.*)$', address)
|
withdelim = re.match('^([^\+]+)\+([^@]+)@(.*)$', address)
|
||||||
if withdelim:
|
if withdelim:
|
||||||
return (withdelim.group(1) + '@' + withdelim.group(3), withdelim.group(2))
|
return (withdelim.group(1) + '@' + withdelim.group(3), withdelim.group(2))
|
||||||
else:
|
else:
|
||||||
return (address, None)
|
return (address, None)
|
||||||
|
|
||||||
def is_pgp_inline(payload):
|
def is_pgp_inline(payload):
|
||||||
"""Finds out if the payload (bytes) contains PGP/INLINE markers."""
|
"""Finds out if the payload (bytes) contains PGP/INLINE markers."""
|
||||||
return PGP_INLINE_BEGIN in payload and PGP_INLINE_END in payload
|
return PGP_INLINE_BEGIN in payload and PGP_INLINE_END in payload
|
||||||
|
|
Loading…
Reference in New Issue