MCPcopy Index your code
hub / github.com/RustPython/RustPython / _handle_text

Method _handle_text

Lib/email/generator.py:244–263  ·  view source on GitHub ↗
(self, msg)

Source from the content-addressed store, hash-verified

242 #
243
244 def _handle_text(self, msg):
245 payload = msg.get_payload()
246 if payload is None:
247 return
248 if not isinstance(payload, str):
249 raise TypeError('string payload expected: %s' % type(payload))
250 if _has_surrogates(msg._payload):
251 charset = msg.get_param('charset')
252 if charset is not None:
253 # XXX: This copy stuff is an ugly hack to avoid modifying the
254 # existing message.
255 msg = deepcopy(msg)
256 del msg['content-transfer-encoding']
257 msg.set_payload(msg._payload, charset)
258 payload = msg.get_payload()
259 self._munge_cte = (msg['content-transfer-encoding'],
260 msg['content-type'])
261 if self._mangle_from_:
262 payload = fcre.sub('>From ', payload)
263 self._write_lines(payload)
264
265 # Default body handler
266 _writeBody = _handle_text

Callers 1

_handle_textMethod · 0.45

Calls 8

_write_linesMethod · 0.95
_has_surrogatesFunction · 0.90
deepcopyFunction · 0.90
isinstanceFunction · 0.85
get_payloadMethod · 0.80
get_paramMethod · 0.80
set_payloadMethod · 0.80
subMethod · 0.45

Tested by

no test coverage detected