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

Method parse

Lib/email/parser.py:95–107  ·  view source on GitHub ↗

Create a message structure from the data in a binary file. Reads all the data from the file and 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, mean

(self, fp, headersonly=False)

Source from the content-addressed store, hash-verified

93 self.parser = Parser(*args, **kw)
94
95 def parse(self, fp, headersonly=False):
96 """Create a message structure from the data in a binary file.
97
98 Reads all the data from the file and returns the root of the message
99 structure. Optional headersonly is a flag specifying whether to stop
100 parsing after reading the headers or not. The default is False,
101 meaning it parses the entire contents of the file.
102 """
103 fp = TextIOWrapper(fp, encoding='ascii', errors='surrogateescape')
104 try:
105 return self.parser.parse(fp, headersonly)
106 finally:
107 fp.detach()
108
109
110 def parsebytes(self, text, headersonly=False):

Callers

nothing calls this directly

Calls 3

detachMethod · 0.95
TextIOWrapperClass · 0.90
parseMethod · 0.45

Tested by

no test coverage detected