Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/email/mime/base.py: 50%
12 statements
« prev ^ index » next coverage.py v7.0.5, created at 2023-01-17 06:13 +0000
« prev ^ index » next coverage.py v7.0.5, created at 2023-01-17 06:13 +0000
1# Copyright (C) 2001-2006 Python Software Foundation
2# Author: Barry Warsaw
3# Contact: email-sig@python.org
5"""Base class for MIME specializations."""
7__all__ = ['MIMEBase']
9import email.policy
11from email import message
15class MIMEBase(message.Message):
16 """Base class for MIME specializations."""
18 def __init__(self, _maintype, _subtype, *, policy=None, **_params):
19 """This constructor adds a Content-Type: and a MIME-Version: header.
21 The Content-Type: header is taken from the _maintype and _subtype
22 arguments. Additional parameters for this header are taken from the
23 keyword arguments.
24 """
25 if policy is None:
26 policy = email.policy.compat32
27 message.Message.__init__(self, policy=policy)
28 ctype = '%s/%s' % (_maintype, _subtype)
29 self.add_header('Content-Type', ctype, **_params)
30 self['MIME-Version'] = '1.0'