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

Class AttributesImpl

Lib/xml/sax/xmlreader.py:276–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274# ===== ATTRIBUTESIMPL =====
275
276class AttributesImpl:
277
278 def __init__(self, attrs):
279 """Non-NS-aware implementation.
280
281 attrs should be of the form {name : value}."""
282 self._attrs = attrs
283
284 def getLength(self):
285 return len(self._attrs)
286
287 def getType(self, name):
288 return "CDATA"
289
290 def getValue(self, name):
291 return self._attrs[name]
292
293 def getValueByQName(self, name):
294 return self._attrs[name]
295
296 def getNameByQName(self, name):
297 if name not in self._attrs:
298 raise KeyError(name)
299 return name
300
301 def getQNameByName(self, name):
302 if name not in self._attrs:
303 raise KeyError(name)
304 return name
305
306 def getNames(self):
307 return list(self._attrs.keys())
308
309 def getQNames(self):
310 return list(self._attrs.keys())
311
312 def __len__(self):
313 return len(self._attrs)
314
315 def __getitem__(self, name):
316 return self._attrs[name]
317
318 def keys(self):
319 return list(self._attrs.keys())
320
321 def __contains__(self, name):
322 return name in self._attrs
323
324 def get(self, name, alternative=None):
325 return self._attrs.get(name, alternative)
326
327 def copy(self):
328 return self.__class__(self._attrs)
329
330 def items(self):
331 return list(self._attrs.items())
332
333 def values(self):

Callers 5

test_attrs_emptyMethod · 0.90
test_attrs_wattrMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
start_elementMethod · 0.85

Calls

no outgoing calls

Tested by 4

test_attrs_emptyMethod · 0.72
test_attrs_wattrMethod · 0.72
parseMethod · 0.72
parseMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…