MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / parse

Method parse

tools/python-3.11.9-amd64/Lib/email/parser.py:98–110  ·  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,

(self, fp, headersonly=False)

Source from the content-addressed store, hash-verified

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