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

Function parse

Lib/xml/dom/expatbuilder.py:896–911  ·  view source on GitHub ↗

Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object.

(file, namespaces=True)

Source from the content-addressed store, hash-verified

894
895
896def parse(file, namespaces=True):
897 """Parse a document, returning the resulting Document node.
898
899 'file' may be either a file name or an open file object.
900 """
901 if namespaces:
902 builder = ExpatBuilderNS()
903 else:
904 builder = ExpatBuilder()
905
906 if isinstance(file, str):
907 with open(file, 'rb') as fp:
908 result = builder.parseFile(fp)
909 else:
910 result = builder.parseFile(file)
911 return result
912
913
914def parseString(string, namespaces=True):

Callers

nothing calls this directly

Calls 4

parseFileMethod · 0.95
ExpatBuilderNSClass · 0.85
ExpatBuilderClass · 0.85
openFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…