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

Method resolveEntity

Lib/xml/dom/xmlbuilder.py:215–235  ·  view source on GitHub ↗
(self, publicId, systemId)

Source from the content-addressed store, hash-verified

213 __slots__ = '_opener',
214
215 def resolveEntity(self, publicId, systemId):
216 assert systemId is not None
217 source = DOMInputSource()
218 source.publicId = publicId
219 source.systemId = systemId
220 source.byteStream = self._get_opener().open(systemId)
221
222 # determine the encoding if the transport provided it
223 source.encoding = self._guess_media_encoding(source)
224
225 # determine the base URI is we can
226 import posixpath, urllib.parse
227 parts = urllib.parse.urlparse(systemId)
228 scheme, netloc, path, params, query, fragment = parts
229 # XXX should we check the scheme here as well?
230 if path and not path.endswith("/"):
231 path = posixpath.dirname(path) + "/"
232 parts = scheme, netloc, path, params, query, fragment
233 source.baseURI = urllib.parse.urlunparse(parts)
234
235 return source
236
237 def _get_opener(self):
238 try:

Callers 2

test_entity_resolverMethod · 0.95
parseURIMethod · 0.45

Calls 6

_get_openerMethod · 0.95
_guess_media_encodingMethod · 0.95
DOMInputSourceClass · 0.85
openMethod · 0.45
endswithMethod · 0.45
dirnameMethod · 0.45

Tested by 1

test_entity_resolverMethod · 0.76