Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(12)

Delta Between Two Patch Sets: Doc/library/email.iterators.rst

Issue 18761: Fix internal doc references for the email package (Closed)
Left Patch Set: Created 6 years, 9 months ago
Right Patch Set: Created 6 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Doc/library/email.headerregistry.rst ('k') | Doc/library/email.message.rst » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 :mod:`email.iterators`: Iterators 1 :mod:`email.iterators`: Iterators
2 --------------------------------- 2 ---------------------------------
3 3
4 .. module:: email.iterators 4 .. module:: email.iterators
5 :synopsis: Iterate over a message object tree. 5 :synopsis: Iterate over a message object tree.
6 6
7 7
8 Iterating over a message object tree is fairly easy with the 8 Iterating over a message object tree is fairly easy with the
9 :meth:`Message.walk <email.message.Message.walk>` method. The :mod:`email.itera tors` module provides some 9 :meth:`Message.walk <email.message.Message.walk>` method. The
10 useful higher level iterations over message object trees. 10 :mod:`email.iterators` module provides some useful higher level iterations over
11 message object trees.
11 12
12 13
13 .. function:: body_line_iterator(msg, decode=False) 14 .. function:: body_line_iterator(msg, decode=False)
14 15
15 This iterates over all the payloads in all the subparts of *msg*, returning t he 16 This iterates over all the payloads in all the subparts of *msg*, returning t he
16 string payloads line-by-line. It skips over all the subpart headers, and it 17 string payloads line-by-line. It skips over all the subpart headers, and it
17 skips over any subpart with a payload that isn't a Python string. This is 18 skips over any subpart with a payload that isn't a Python string. This is
18 somewhat equivalent to reading the flat text representation of the message fr om 19 somewhat equivalent to reading the flat text representation of the message fr om
19 a file using :meth:`~io.TextIOBase.readline`, skipping over all the interveni ng headers. 20 a file using :meth:`~io.TextIOBase.readline`, skipping over all the
21 intervening headers.
20 22
21 Optional *decode* is passed through to :meth:`Message.get_payload <email.mess age.Message.get_payload>`. 23 Optional *decode* is passed through to :meth:`Message.get_payload
24 <email.message.Message.get_payload>`.
22 25
23 26
24 .. function:: typed_subpart_iterator(msg, maintype='text', subtype=None) 27 .. function:: typed_subpart_iterator(msg, maintype='text', subtype=None)
25 28
26 This iterates over all the subparts of *msg*, returning only those subparts t hat 29 This iterates over all the subparts of *msg*, returning only those subparts t hat
27 match the MIME type specified by *maintype* and *subtype*. 30 match the MIME type specified by *maintype* and *subtype*.
28 31
29 Note that *subtype* is optional; if omitted, then subpart MIME type matching is 32 Note that *subtype* is optional; if omitted, then subpart MIME type matching is
30 done only with the main type. *maintype* is optional too; it defaults to 33 done only with the main type. *maintype* is optional too; it defaults to
31 :mimetype:`text`. 34 :mimetype:`text`.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 text/plain 71 text/plain
69 text/plain 72 text/plain
70 73
71 .. testsetup:: 74 .. testsetup::
72 75
73 >>> somefile.close() 76 >>> somefile.close()
74 77
75 Optional *fp* is a file-like object to print the output to. It must be 78 Optional *fp* is a file-like object to print the output to. It must be
76 suitable for Python's :func:`print` function. *level* is used internally. 79 suitable for Python's :func:`print` function. *level* is used internally.
77 *include_default*, if true, prints the default type as well. 80 *include_default*, if true, prints the default type as well.
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+