diff options
author | guido@google.com <guido@google.com> | 2011-03-29 19:09:45 (GMT) |
---|---|---|
committer | guido@google.com <guido@google.com> | 2011-03-29 19:09:45 (GMT) |
commit | 69cfcabae3d72845d44e1078d25072fdbb02072c (patch) | |
tree | 0aedaa424e8c8f7139567aed7b6980ea59e16c97 /Lib/email/parser.py | |
parent | 2008a8f8c09b18fbd24e8039553d50a828dd3fb2 (diff) | |
parent | e6c1eb92675f67d1907bd7ba00c44262c18e93d4 (diff) | |
download | cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.zip cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.tar.gz cpython-69cfcabae3d72845d44e1078d25072fdbb02072c.tar.bz2 |
Merge.
Diffstat (limited to 'Lib/email/parser.py')
-rw-r--r-- | Lib/email/parser.py | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/Lib/email/parser.py b/Lib/email/parser.py index 6caaff5..ef051fa 100644 --- a/Lib/email/parser.py +++ b/Lib/email/parser.py @@ -15,7 +15,7 @@ from email.message import Message class Parser: - def __init__(self, *args, **kws): + def __init__(self, _class=Message): """Parser of RFC 2822 and MIME email messages. Creates an in-memory object tree representing the email message, which @@ -31,27 +31,7 @@ class Parser: must be created. This class must have a constructor that can take zero arguments. Default is Message.Message. """ - if len(args) >= 1: - if '_class' in kws: - raise TypeError("Multiple values for keyword arg '_class'") - kws['_class'] = args[0] - if len(args) == 2: - if 'strict' in kws: - raise TypeError("Multiple values for keyword arg 'strict'") - kws['strict'] = args[1] - if len(args) > 2: - raise TypeError('Too many arguments') - if '_class' in kws: - self._class = kws['_class'] - del kws['_class'] - else: - self._class = Message - if 'strict' in kws: - warnings.warn("'strict' argument is deprecated (and ignored)", - DeprecationWarning, 2) - del kws['strict'] - if kws: - raise TypeError('Unexpected keyword arguments') + self._class = _class def parse(self, fp, headersonly=False): """Create a message structure from the data in a file. |