Iterates over all direct child nodes of the node.  This iterates
        over all fields and yields the values of they are nodes.  If the value
        of a field is a list all the nodes in that list are returned.
338102
def iter_child_nodes(self, exclude=None, only=None):
        
        for field, item in self.iter_fields(exclude, only):
            if isinstance(item, list):
                for n in item:
                    if isinstance(n, Node):
                        yield n
            elif isinstance(item, Node):
                yield item
794412
def children(self, recursive=False):
        
        for i in xrange(self.childCount()):
            child = self.child(i)
            yield child
            
            if recursive:
                for subchild in child.children(recursive=True):
                    yield subchild
764882
def getAllNodeUids(self):
        '''
            
        '''
        ret = set()

        for child in self:
            ret.update(child.getAllNodeUids())

        return ret
1099600
def data_children(self) -> List["DataNode"]:
        """"""
        res = []
        for child in self.children:
            if isinstance(child, DataNode):
                res.append(child)
            elif not isinstance(child, SchemaTreeNode):
                res.extend(child.data_children())
        return res
1255066
def iter_fields(node):
    """"""
    # CPython 2.5 compat
    if not hasattr(node, '_fields') or not node._fields:
        return
    for field in node._fields:
        try:
            yield field, getattr(node, field)
        except AttributeError:
            pass
863034
def _get_children(node, contexts=False, restrict=None, parent=None):
        """"""
        yield (parent, node) if contexts else node
        if restrict and isinstance(node, restrict):
            return
        for code in node.__children__():
            for child in code.nodes:
                sub = Wikicode._get_children(child, contexts, restrict, code)
                for result in sub:
                    yield result
84966
def _nodes_to_values(self):
        
        def is_none(slice):
            return slice[0] == -1 and slice[1] == -1

        def get(slice):
            return self.string[slice[0]:slice[1]]

        return [(varname, get(slice), slice) for varname, slice in self._nodes_to_regs() if not is_none(slice)]
1283616
def assign_fields(self):
        
        # We must fix fields at every level of the hierarchy separately
        # (otherwise fields of children won't be allowed to overlap). Here we
        # do a breadth-first iteration over the hierarchy to fix fields with
        # given starting positions; then we do depth-first to fix other fields.

        # Assign all fields with a fixed starting position in breadth first,
        # top-down order. The breadth-first ensures that children's fixed
        # position fields must fit around the fixed position fields of their
        # parents.
        queue = [(self.fields, {})]
        while queue:
            node, field_values = queue.pop(0)

            # Assign all fields at this level whose position is fixed
            self._assign_fields(node.fields, field_values,
                                assign_positions=False)

            # Breadth-first search through children
            for requirements, child in iteritems(node.children):
                requirements = dict(requirements)
                requirements.update(field_values)
                queue.append((child, requirements))

        # Assign all fields with movable starting positions in leaf-first,
        # depth-first order.  The depth first ordering for variable position
        # fields ensures that parents don't allocate fields in positions which
        # would collide with fixed and variable position fields their children
        # have already allocated.

        def recurse_assign_fields(node=self.fields, field_values={}):
            # Assign fields of child nodes first (allowing them to allocate
            # bits independently)
            for requirements, child in iteritems(node.children):
                child_field_values = dict(requirements)
                child_field_values.update(field_values)
                recurse_assign_fields(child, child_field_values)

            # Finally, assign all remaining fields at this level in the tree
            self._assign_fields(node.fields, field_values,
                                assign_positions=True)
        recurse_assign_fields()
889890
def collect_fields(node):
    
    fields = set()
    for leaf in node:
        if leaf.get('kind', None) == "Field":
            fields.add(leaf["name"]["value"])

        if leaf.get("selection_set", None):
            fields = fields.union(collect_fields(leaf["selection_set"]["selections"]))

    return fields
738238
def each(&blk)
      fields.each do |field|
        if field.child?
          val = self.send(field.reader)
          yield val unless val.nil?
        end
      end
      return self
    end
839875
def generic_visit(self, node: AST, dfltChaining: bool = True) -> str:
        
        for field, value in ast.iter_fields(node):
            if isinstance(value, list):
                for item in value:
                    if isinstance(item, AST):
                        self.visit(item)
            elif isinstance(value, AST):
                self.visit(value)
75790
def nodes(self, value):
        
        # pylint: disable=attribute-defined-outside-init
        self._nodes = value
        self._index2node = {node.index: node for node in self._nodes}
1085729
def _is_child_wikicode(self, obj, recursive=True):
        """"""
        def deref(nodes):
            if isinstance(nodes, _ListProxy):
                return nodes._parent  # pylint: disable=protected-access
            return nodes

        target = deref(obj.nodes)
        if target is deref(self.nodes):
            return True
        if recursive:
            todo = [self]
            while todo:
                code = todo.pop()
                if target is deref(code.nodes):
                    return True
                for node in code.nodes:
                    todo += list(node.__children__())
        return False
455246
def to_tree(instance, *children):
    

    # Yield representation of self
    yield unicode(instance)

    # Iterate trough each instance child collection
    for i, child in enumerate(children):
        lines = 0

        yield "|"
        yield "+---" + unicode(child)

        if i != len(children) - 1:
            a = "|"
        else:
            a = " "

        # Iterate trough all values of collection of child
        for j, item in enumerate(child.itervalues()):
            if j != len(child) - 1:
                b = "|"
            else:
                b = " "

            if j == 0:
                yield a + "   |"

            # Append prefix to each line
            for k, line in enumerate(item.to_tree()):
                lines += 1

                if k == 0:
                    yield a + "   +---" + line
                else:
                    yield a + "   " + b + "   " + line

        # Add extra space if required
        if len(children) > 1 and i == len(children) - 1 and lines > 1:
            yield a
726864
def all_original_children(self):
        ''''''
        return chain.from_iterable(
            c.all_nodes_in_subtree()
            for lnk, c in self.children
            if lnk == self.LINK_CHILD)
941741
def _fetchAllChildren(self):
        
        assert self.canFetchChildren(), "canFetchChildren must be True"

        childItems = []

        # Add fields
        if self._isStructured:
            for fieldName in self._h5Dataset.dtype.names:
                childItems.append(H5pyFieldRti(self._h5Dataset, nodeName=fieldName,
                                               fileName=self.fileName))

        return childItems
1232330
def find_all(self, node_type):
        
        for child in self.iter_child_nodes():
            if isinstance(child, node_type):
                yield child
            for result in child.find_all(node_type):
                yield result