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

Method parseFile

Lib/xml/dom/expatbuilder.py:197–214  ·  view source on GitHub ↗

Parse a document from a file object, returning the document node.

(self, file)

Source from the content-addressed store, hash-verified

195 parser.AttlistDeclHandler = self.attlist_decl_handler
196
197 def parseFile(self, file):
198 """Parse a document from a file object, returning the document
199 node."""
200 parser = self.getParser()
201 first_buffer = True
202 try:
203 while buffer := file.read(16*1024):
204 parser.Parse(buffer, False)
205 if first_buffer and self.document.documentElement:
206 self._setup_subset(buffer)
207 first_buffer = False
208 parser.Parse(b"", True)
209 except ParseEscape:
210 pass
211 doc = self.document
212 self.reset()
213 self._parser = None
214 return doc
215
216 def parseString(self, string):
217 """Parse a document from a string, returning the document node."""

Callers 3

parseFunction · 0.95
_parse_bytestreamMethod · 0.45
parseFileMethod · 0.45

Calls 4

getParserMethod · 0.95
_setup_subsetMethod · 0.95
resetMethod · 0.95
readMethod · 0.45

Tested by

no test coverage detected