MCPcopy Index your code
hub / github.com/RustPython/RustPython / ExpatLocator

Class ExpatLocator

Lib/xml/sax/expatreader.py:45–76  ·  view source on GitHub ↗

Locator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler.

Source from the content-addressed store, hash-verified

43# --- ExpatLocator
44
45class ExpatLocator(xmlreader.Locator):
46 """Locator for use with the ExpatParser class.
47
48 This uses a weak reference to the parser object to avoid creating
49 a circular reference between the parser and the content handler.
50 """
51 def __init__(self, parser):
52 self._ref = _mkproxy(parser)
53
54 def getColumnNumber(self):
55 parser = self._ref
56 if parser._parser is None:
57 return None
58 return parser._parser.ErrorColumnNumber
59
60 def getLineNumber(self):
61 parser = self._ref
62 if parser._parser is None:
63 return 1
64 return parser._parser.ErrorLineNumber
65
66 def getPublicId(self):
67 parser = self._ref
68 if parser is None:
69 return None
70 return parser._source.getPublicId()
71
72 def getSystemId(self):
73 parser = self._ref
74 if parser is None:
75 return None
76 return parser._source.getSystemId()
77
78
79# --- ExpatParser

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected