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

Method _setroot

Lib/xml/etree/ElementTree.py:541–551  ·  view source on GitHub ↗

Replace root element of this tree. This will discard the current contents of the tree and replace it with the given element. Use with care!

(self, element)

Source from the content-addressed store, hash-verified

539 return self._root
540
541 def _setroot(self, element):
542 """Replace root element of this tree.
543
544 This will discard the current contents of the tree and replace it
545 with the given element. Use with care!
546
547 """
548 if not iselement(element):
549 raise TypeError('expected an Element, not %s'
550 % type(element).__name__)
551 self._root = element
552
553 def parse(self, source, parser=None):
554 """Load external XML document into element tree.

Callers 1

test_setrootMethod · 0.95

Calls 1

iselementFunction · 0.85

Tested by 1

test_setrootMethod · 0.76