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

Method parse

tools/python-3.11.9-amd64/Lib/email/parser.py:41–57  ·  view source on GitHub ↗

Create a message structure from the data in a 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, meanin

(self, fp, headersonly=False)

Source from the content-addressed store, hash-verified

39 self.policy = policy
40
41 def parse(self, fp, headersonly=False):
42 """Create a message structure from the data in a file.
43
44 Reads all the data from the file and returns the root of the message
45 structure. Optional headersonly is a flag specifying whether to stop
46 parsing after reading the headers or not. The default is False,
47 meaning it parses the entire contents of the file.
48 """
49 feedparser = FeedParser(self._class, policy=self.policy)
50 if headersonly:
51 feedparser._set_headersonly()
52 while True:
53 data = fp.read(8192)
54 if not data:
55 break
56 feedparser.feed(data)
57 return feedparser.close()
58
59 def parsestr(self, text, headersonly=False):
60 """Create a message structure from a string.

Callers 10

parsestrMethod · 0.95
_check_rst_dataMethod · 0.95
_check_rst_dataMethod · 0.95
message_from_fileFunction · 0.45
message_from_binary_fileFunction · 0.45
parseMethod · 0.45
parseMethod · 0.45
parseMethod · 0.45
compileFunction · 0.45
__init__Method · 0.45

Calls 5

_set_headersonlyMethod · 0.95
feedMethod · 0.95
closeMethod · 0.95
FeedParserClass · 0.90
readMethod · 0.45

Tested by

no test coverage detected