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

Method as_string

Lib/email/message.py:998–1012  ·  view source on GitHub ↗

Return the entire formatted message as a string. Optional 'unixfrom', when true, means include the Unix From_ envelope header. maxheaderlen is retained for backward compatibility with the base Message class, but defaults to None, meaning that the policy value for ma

(self, unixfrom=False, maxheaderlen=None, policy=None)

Source from the content-addressed store, hash-verified

996
997
998 def as_string(self, unixfrom=False, maxheaderlen=None, policy=None):
999 """Return the entire formatted message as a string.
1000
1001 Optional 'unixfrom', when true, means include the Unix From_ envelope
1002 header. maxheaderlen is retained for backward compatibility with the
1003 base Message class, but defaults to None, meaning that the policy value
1004 for max_line_length controls the header maximum length. 'policy' is
1005 passed to the Generator instance used to serialize the message; if it
1006 is not specified the policy associated with the message instance is
1007 used.
1008 """
1009 policy = self.policy if policy is None else policy
1010 if maxheaderlen is None:
1011 maxheaderlen = policy.max_line_length
1012 return super().as_string(unixfrom, maxheaderlen, policy)
1013
1014 def __str__(self):
1015 return self.as_string(policy=self.policy.clone(utf8=True))

Callers 1

__str__Method · 0.95

Calls 2

superClass · 0.85
as_stringMethod · 0.45

Tested by

no test coverage detected