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

Class ExpatLocator

Lib/xml/sax/expatreader.py:43–74  ·  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

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

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…