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

Method iter

Lib/xml/etree/ElementTree.py:377–397  ·  view source on GitHub ↗

Create tree iterator. The iterator loops over the element and all subelements in document order, returning all elements with a matching tag. If the tree structure is modified during iteration, new or removed elements may or may not be included. To get a stable set,

(self, tag=None)

Source from the content-addressed store, hash-verified

375 return self.attrib.items()
376
377 def iter(self, tag=None):
378 """Create tree iterator.
379
380 The iterator loops over the element and all subelements in document
381 order, returning all elements with a matching tag.
382
383 If the tree structure is modified during iteration, new or removed
384 elements may or may not be included. To get a stable set, use the
385 list() function on the iterator, and loop over the resulting list.
386
387 *tag* is what tags to look for (default is to return all elements)
388
389 Return an iterator containing all the matching elements.
390
391 """
392 if tag == "*":
393 tag = None
394 if tag is None or self.tag == tag:
395 yield self
396 for e in self._children:
397 yield from e.iter(tag)
398
399 def itertext(self):
400 """Create text iterator.

Callers 10

test_lost_elemMethod · 0.95
test_copyMethod · 0.95
test_pickleMethod · 0.95
get_parent_mapFunction · 0.45
select_childFunction · 0.45
selectFunction · 0.45
iterMethod · 0.45
_namespacesFunction · 0.45
XMLIDFunction · 0.45

Calls

no outgoing calls

Tested by 4

test_lost_elemMethod · 0.76
test_copyMethod · 0.76
test_pickleMethod · 0.76