docstr: 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,
  meaning it parses the entire contents of the file.
docstr_tok: ["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",",","meaning","it","parses","the","entire","contents","of","the","file","."]
code: def parse(self, fp, headersonly=False):
      """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,
      meaning it parses the entire contents of the file.
      """
      feedparser = FeedParser(self._class, policy=self.policy)
      if headersonly:
          feedparser._set_headersonly()
      while True:
          data = fp.read(8192)
          if not data:
              break
          feedparser.feed(data)
      return feedparser.close()
  
file_path: catboost/contrib/tools/python3/src/Lib/email/parser.py
imports: from io import StringIO, TextIOWrapper
  from email.feedparser import FeedParser, BytesFeedParser
  from email._policybase import compat32
label_desc: Use image node_id 2 for calling the Parser obj's underlying member method code with example usage: obj.parse(fp, headersonly) and returns: feedparser