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

Method parsebytes

Lib/email/parser.py:110–119  ·  view source on GitHub ↗

Create a message structure from a byte string. Returns the root of the message structure. Optional headersonly is a flag specifying whether to stop parsing after reading the headers or not. The default is False, meaning it parses the entire contents of the file.

(self, text, headersonly=False)

Source from the content-addressed store, hash-verified

108
109
110 def parsebytes(self, text, headersonly=False):
111 """Create a message structure from a byte string.
112
113 Returns the root of the message structure. Optional headersonly is a
114 flag specifying whether to stop parsing after reading the headers or
115 not. The default is False, meaning it parses the entire contents of
116 the file.
117 """
118 text = text.decode('ASCII', errors='surrogateescape')
119 return self.parser.parsestr(text, headersonly)
120
121
122class BytesHeaderParser(BytesParser):

Callers 3

test_bytes_parserMethod · 0.95
message_from_bytesFunction · 0.45
parsebytesMethod · 0.45

Calls 2

decodeMethod · 0.45
parsestrMethod · 0.45

Tested by 1

test_bytes_parserMethod · 0.76