MCPcopy Index your code
hub / github.com/python/cpython / body_line_iterator

Function body_line_iterator

Lib/email/iterators.py:32–40  ·  view source on GitHub ↗

Iterate over the parts, returning string payloads line-by-line. Optional decode (default False) is passed through to .get_payload().

(msg, decode=False)

Source from the content-addressed store, hash-verified

30
31# These two functions are imported into the Iterators.py interface module.
32def body_line_iterator(msg, decode=False):
33 """Iterate over the parts, returning string payloads line-by-line.
34
35 Optional decode (default False) is passed through to .get_payload().
36 """
37 for subpart in msg.walk():
38 payload = subpart.get_payload(decode=decode)
39 if isinstance(payload, str):
40 yield from StringIO(payload)
41
42
43def typed_subpart_iterator(msg, maintype='text', subtype=None):

Callers

nothing calls this directly

Calls 3

StringIOClass · 0.90
get_payloadMethod · 0.80
walkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…