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

Python code coverage for Lib/email/__init__.py

#countcontent
1n/a# Copyright (C) 2001-2007 Python Software Foundation
2n/a# Author: Barry Warsaw
3n/a# Contact: email-sig@python.org
4n/a
5n/a"""A package for parsing, handling, and generating email messages."""
6n/a
7n/a__all__ = [
8n/a 'base64mime',
9n/a 'charset',
10n/a 'encoders',
11n/a 'errors',
12n/a 'feedparser',
13n/a 'generator',
14n/a 'header',
15n/a 'iterators',
16n/a 'message',
17n/a 'message_from_file',
18n/a 'message_from_binary_file',
19n/a 'message_from_string',
20n/a 'message_from_bytes',
21n/a 'mime',
22n/a 'parser',
23n/a 'quoprimime',
24n/a 'utils',
25n/a ]
26n/a
27n/a
28n/a
29n/a# Some convenience routines. Don't import Parser and Message as side-effects
30n/a# of importing email since those cascadingly import most of the rest of the
31n/a# email package.
32n/adef message_from_string(s, *args, **kws):
33n/a """Parse a string into a Message object model.
34n/a
35n/a Optional _class and strict are passed to the Parser constructor.
36n/a """
37n/a from email.parser import Parser
38n/a return Parser(*args, **kws).parsestr(s)
39n/a
40n/adef message_from_bytes(s, *args, **kws):
41n/a """Parse a bytes string into a Message object model.
42n/a
43n/a Optional _class and strict are passed to the Parser constructor.
44n/a """
45n/a from email.parser import BytesParser
46n/a return BytesParser(*args, **kws).parsebytes(s)
47n/a
48n/adef message_from_file(fp, *args, **kws):
49n/a """Read a file and parse its contents into a Message object model.
50n/a
51n/a Optional _class and strict are passed to the Parser constructor.
52n/a """
53n/a from email.parser import Parser
54n/a return Parser(*args, **kws).parse(fp)
55n/a
56n/adef message_from_binary_file(fp, *args, **kws):
57n/a """Read a binary file and parse its contents into a Message object model.
58n/a
59n/a Optional _class and strict are passed to the Parser constructor.
60n/a """
61n/a from email.parser import BytesParser
62n/a return BytesParser(*args, **kws).parse(fp)