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

Method _handle_message

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

Source from the content-addressed store, hash-verified

356 self._fp.write(self._encoded_NL.join(blocks))
357
358 def _handle_message(self, msg):
359 s = self._new_buffer()
360 g = self.clone(s)
361 # The payload of a message/rfc822 part should be a multipart sequence
362 # of length 1. The zeroth element of the list should be the Message
363 # object for the subpart. Extract that object, stringify it, and
364 # write it out.
365 # Except, it turns out, when it's a string instead, which happens when
366 # and only when HeaderParser is used on a message of mime type
367 # message/rfc822. Such messages are generated by, for example,
368 # Groupwise when forwarding unadorned messages. (Issue 7970.) So
369 # in that case we just emit the string body.
370 payload = msg._payload
371 if isinstance(payload, list):
372 g.flatten(msg.get_payload(0), unixfrom=False, linesep=self._NL)
373 payload = s.getvalue()
374 else:
375 payload = self._encode(payload)
376 self._fp.write(payload)
377
378 # This used to be a module level function; we use a classmethod for this
379 # and _compile_re so we can continue to provide the module level function

Callers

nothing calls this directly

Calls 8

_new_bufferMethod · 0.95
cloneMethod · 0.95
_encodeMethod · 0.95
isinstanceFunction · 0.85
get_payloadMethod · 0.80
flattenMethod · 0.45
getvalueMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected