ยปCore Development>Code coverage>Lib/email/mime/base.py

Python code coverage for Lib/email/mime/base.py

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