Skip to content

Commit 8b3febe

Browse files
committed
Copying the email package back, despite its failings.
1 parent 21b731f commit 8b3febe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+9910
-0
lines changed

Lib/email/__init__.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (C) 2001-2007 Python Software Foundation
2+
# Author: Barry Warsaw
3+
4+
5+
"""A package for parsing, handling, and generating email messages."""
6+
7+
__version__ = '5.0.0'
8+
9+
__all__ = [
10+
'base64mime',
11+
'charset',
12+
'encoders',
13+
'errors',
14+
'generator',
15+
'header',
16+
'iterators',
17+
'message',
18+
'message_from_file',
19+
'message_from_string',
20+
'mime',
21+
'parser',
22+
'quoprimime',
23+
'utils',
24+
]
25+
26+
27+
28+
# Some convenience routines. Don't import Parser and Message as side-effects
29+
# of importing email since those cascadingly import most of the rest of the
30+
# email package.
31+
def message_from_string(s, *args, **kws):
32+
"""Parse a string into a Message object model.
33+
34+
Optional _class and strict are passed to the Parser constructor.
35+
"""
36+
from email.parser import Parser
37+
return Parser(*args, **kws).parsestr(s)
38+
39+
40+
def message_from_file(fp, *args, **kws):
41+
"""Read a file and parse its contents into a Message object model.
42+
43+
Optional _class and strict are passed to the Parser constructor.
44+
"""
45+
from email.parser import Parser
46+
return Parser(*args, **kws).parse(fp)

0 commit comments

Comments
 (0)