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

Class AttributesNSImpl

Lib/xml/sax/xmlreader.py:338–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336# ===== ATTRIBUTESNSIMPL =====
337
338class AttributesNSImpl(AttributesImpl):
339
340 def __init__(self, attrs, qnames):
341 """NS-aware implementation.
342
343 attrs should be of the form {(ns_uri, lname): value, ...}.
344 qnames of the form {(ns_uri, lname): qname, ...}."""
345 self._attrs = attrs
346 self._qnames = qnames
347
348 def getValueByQName(self, name):
349 for (nsname, qname) in self._qnames.items():
350 if qname == name:
351 return self._attrs[nsname]
352
353 raise KeyError(name)
354
355 def getNameByQName(self, name):
356 for (nsname, qname) in self._qnames.items():
357 if qname == name:
358 return nsname
359
360 raise KeyError(name)
361
362 def getQNameByName(self, name):
363 return self._qnames[name]
364
365 def getQNames(self):
366 return list(self._qnames.values())
367
368 def copy(self):
369 return self.__class__(self._attrs, self._qnames)
370
371
372def _test():

Callers 3

test_nsattrs_emptyMethod · 0.90
test_nsattrs_wattrMethod · 0.90
start_element_nsMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_nsattrs_emptyMethod · 0.72
test_nsattrs_wattrMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…