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

Function _prepare_set

Lib/email/contentmanager.py:98–112  ·  view source on GitHub ↗
(msg, maintype, subtype, headers)

Source from the content-addressed store, hash-verified

96
97
98def _prepare_set(msg, maintype, subtype, headers):
99 msg['Content-Type'] = '/'.join((maintype, subtype))
100 if headers:
101 if not hasattr(headers[0], 'name'):
102 mp = msg.policy
103 headers = [mp.header_factory(*mp.header_source_parse([header]))
104 for header in headers]
105 try:
106 for header in headers:
107 if header.defects:
108 raise header.defects[0]
109 msg[header.name] = header
110 except email.errors.HeaderDefect as exc:
111 raise ValueError("Invalid header: {}".format(
112 header.fold(policy=msg.policy))) from exc
113
114
115def _finalize_set(msg, disposition, filename, cid, params):

Callers 3

set_text_contentFunction · 0.85
set_message_contentFunction · 0.85
set_bytes_contentFunction · 0.85

Calls 4

joinMethod · 0.45
header_source_parseMethod · 0.45
formatMethod · 0.45
foldMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…