annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/email/mime/base.py @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
rev   line source
jpayne@68 1 # Copyright (C) 2001-2006 Python Software Foundation
jpayne@68 2 # Author: Barry Warsaw
jpayne@68 3 # Contact: email-sig@python.org
jpayne@68 4
jpayne@68 5 """Base class for MIME specializations."""
jpayne@68 6
jpayne@68 7 __all__ = ['MIMEBase']
jpayne@68 8
jpayne@68 9 import email.policy
jpayne@68 10
jpayne@68 11 from email import message
jpayne@68 12
jpayne@68 13
jpayne@68 14
jpayne@68 15 class MIMEBase(message.Message):
jpayne@68 16 """Base class for MIME specializations."""
jpayne@68 17
jpayne@68 18 def __init__(self, _maintype, _subtype, *, policy=None, **_params):
jpayne@68 19 """This constructor adds a Content-Type: and a MIME-Version: header.
jpayne@68 20
jpayne@68 21 The Content-Type: header is taken from the _maintype and _subtype
jpayne@68 22 arguments. Additional parameters for this header are taken from the
jpayne@68 23 keyword arguments.
jpayne@68 24 """
jpayne@68 25 if policy is None:
jpayne@68 26 policy = email.policy.compat32
jpayne@68 27 message.Message.__init__(self, policy=policy)
jpayne@68 28 ctype = '%s/%s' % (_maintype, _subtype)
jpayne@68 29 self.add_header('Content-Type', ctype, **_params)
jpayne@68 30 self['MIME-Version'] = '1.0'