Return an iterator over the leaf ASTs.
551228
def leaf_asts(self):
        
        seen = set()

        ast_queue = deque([self])
        while ast_queue:

            ast = ast_queue.pop()
            if isinstance(ast, Base) and id(ast.cache_key) not in seen:
                seen.add(id(ast.cache_key))

                if ast.depth == 1:
                    yield ast
                    continue

                ast_queue.extend(ast.args)
                continue
769842
@Override
    public Iterator<Tree> iterator() {
        return new Iterator<Tree>() {
            @Override
            public boolean hasNext() {
                return next != null;
            }

            @Override
            public Tree next() {
                Tree t = next.leaf;
                next = next.parent;
                return t;
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }

            private TreePath next = TreePath.this;
        };
    }
1314784
def eval_ast(self, ast):
        
        # If there was no last value, it was not constrained, so we can use
        # anything.
        new_ast = ast.replace_dict(self.replacements, leaf_operation=self._leaf_op)
        return backends.concrete.eval(new_ast, 1)[0]
1212531
public static <N extends AbstractDTNode<?, ?, ?, N>> Iterator<N> innerNodeIterator(N root) {
        return Iterators.filter(nodeIterator(root), n -> !n.isLeaf());
    }
1019102
def _iter(root, term):
    '''
    
    '''
    if sys.version_info < (2, 7):
        return root.getiterator(term)
    else:
        return root.iter(term)
981211
def _leaf_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        node = LeafNode()
        node.type = DataType._resolve_type(
            stmt.find1("type", required=True), sctx)
        self._handle_child(node, stmt, sctx)
223695
def items(self):
		

		L = []
		def aux(node, s):
			s = s + node.char
			if node.output is not nil:
				L.append((s, node.output))

			for child in node.children.values():
				if child is not node:
					aux(child, s)

		aux(self.root, '')
		return iter(L)
229771
def iterate(it):
    """"""
    if is_async_iterable(it):
        return from_async_iterable.raw(it)
    if isinstance(it, Iterable):
        return from_iterable.raw(it)
    raise TypeError(
        f"{type(it).__name__!r} object is not (async) iterable")
146557
def num_leaves(tree):
    """"""
    if tree.is_leaf:
        return 1
    else:
        return num_leaves(tree.left_child) + num_leaves(tree.right_child)
420960
def _AtLeaf(self, attr_value):
    """"""
    if isinstance(attr_value, collections.Mapping):
      # If the result is a dict, return each key/value pair as a new dict.
      for k, v in iteritems(attr_value):
        yield {k: v}
    else:
      yield attr_value
597288
function() {
    var dir, leaf, name, names, root, _i, _j, _len, _name;
    root = arguments[0], names = 3 <= arguments.length ? __slice.call(arguments, 1, _i = arguments.length - 1) : (_i = 1, []), name = arguments[_i++];
    leaf = this;
    dir = path.resolve(root);
    for (_j = 0, _len = names.length; _j < _len; _j++) {
      _name = names[_j];
      if (!isObject(leaf[_name])) {
        leaf[_name] = {};
      }
      leaf = leaf[_name];
      dir = path.resolve(dir, _name);
    }
    if (name == null) {
      name = path.basename(dir, path.extname(dir));
      dir = path.dirname(dir);
    }
    walk(leaf, dir, name);
    return this;
  }
1339368
def iter_trees(self, *args, **kwargs):
        """"""
        return (c.tree for c in self.iter_commits(*args, **kwargs))
187406
def recursive_iter(enumerables):
    '''
    
    '''
    if not is_collection(enumerables) or isinstance(enumerables, (basestring, dict)):
        yield enumerables
    else:
        for elem in enumerables:
            for sub_elem in recursive_iter(elem):
                yield sub_elem
104295
private IQTree liftTree(IQTree queryTree, VariableGenerator variableGenerator) {
        if (queryTree instanceof UnaryIQTree)
            return liftUnary((UnaryIQTree) queryTree, variableGenerator);
        else if (queryTree instanceof NaryIQTree)
            return liftNary((NaryIQTree) queryTree, variableGenerator);
        else if (queryTree instanceof BinaryNonCommutativeIQTree)
            return liftBinaryNonCommutative((BinaryNonCommutativeIQTree) queryTree, variableGenerator);
        // Leaf node
        else
            return queryTree;
    }
717350
def t(root, children=None, debug=False, root_id=None):
    ""
    if isinstance(root, Tree):
        if children is None:
            return root
        return root.__class__(root, children, root_id)

    elif isinstance(root, basestring):
        root = debug_root_label(root, debug, root_id)

        # Beware: (DGParented)Tree is a subclass of list!
        if isinstance(children, Tree):
            child_trees = [children]

        elif isinstance(children, list):
            child_trees = []
            for child in children:
                if isinstance(child, Tree):
                    child_trees.append(child)
                elif isinstance(child, list):
                    child_trees.extend(child)
                elif isinstance(child, tuple):
                    child_trees.append(t(*child))
                elif isinstance(child, basestring):
                    child_trees.append(child)
                else:
                    raise NotImplementedError

        elif isinstance(children, basestring):
            # this tree does only have one child, a leaf node
            # TODO: this is a workaround for the following problem:
            # Tree('foo', [Tree('bar', [])]) != Tree('foo', ['bar'])
            child_trees = [Tree(children, [])]

        else:
            # this tree only consists of one leaf node
            assert children is None
            child_trees = []

        return DGParentedTree(root, child_trees, root_id)

    else:
        raise NotImplementedError
358179
def _AsList(arg):
    """"""
    if (isinstance(arg, string_types) or
        not isinstance(arg, collections.Iterable)):
      return [arg]
    else:
      return list(arg)
218089
def iteritems(self):
        """"""
        if self.type in ['blob']:
            raise StopIteration

        for path, mode, sha in self.tree.iteritems():
            item = Item(self, sha, path, mode)
            yield item
            for i in item.iteritems():
                yield i