Yields to each element of specified node_type
 All elements if e_node_type is nil.
10544
def each_element(e_node_type=nil, &block) 
		@children.each do |c| 
			if c.kind_of? MDElement
				if (not e_node_type) || (e_node_type == c.node_type)
					block.call c
				end
				c.each_element(e_node_type, &block)
			end
		end
	end
601721
def _yield_all(self, l):
        '''
        
        '''
        if l is not None:
            if type(l) in [list, tuple]:
                for f in l:
                    for x in self._yield(f): yield x
            else:
                for x in self._yield(l): yield x
624657
function( node, tagNames, onlyOfType ){
			var i = node.children.length,
				countAll = 0,
				countOfType = 0,
				child,
				out = null;

			while(i--) {
				child = node.children[i];
				if(child.nodeType === 1) {
					if(tagNames){
						// count just only-of-type
						if(this.hasTagName(child, tagNames)){
							out = child;
							countOfType++;
						}
					}else{
						// count all elements
						out = child;
						countAll++;
					}
				}
			}
			if(onlyOfType === true){
				return (countOfType === 1)? out : null;
			}else{
				return (countAll === 1)? out : null;
			}
		}
889363
def collect_by_type(self, typ):
        '''
        '''
        nodes = []
        if isinstance(self, typ):
            nodes.append(self)
        for c in self:
            nodes.extend(c.collect_by_type(typ))
        return nodes
941699
def nodes(self) -> iter:
        """"""
        yield from (elem for elem, subs in self.inclusions.items() if subs == ())
56907
def get_element_types(obj, **kwargs):
    """"""

    max_iterable_length = kwargs.get('max_iterable_length', 10000)
    consume_generator = kwargs.get('consume_generator', False)

    if not isiterable(obj):
        return None

    if isgenerator(obj) and not consume_generator:
        return None

    t = get_types(obj, **kwargs)

    if not t['too_big']:
        if t['types']:
            return "Element types: {}".format(', '.join([extract_type(t) for t in t['types']]))
        else:
            return None
    else:
        return "Element types: {}".format(', '.join([extract_type(t) for t in t['types']])) + " (based on first {} elements.)".format(max_iterable_length)
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
511770
def iterate(node)
      return unless node.is_a?(AST::Node)

      before    = :"on_#{node.type}"
      after     = :"after_#{node.type}"
      skip_node = catch :skip_child_nodes do
        execute_callback(before, node)
      end

      if skip_node != node
        node.children.each do |child|
          iterate(child) if child.is_a?(AST::Node)
        end
      end

      execute_callback(after, node)
    end
835453
def any(parser, open_kind, parse_fn, close_kind):
    # type: (Parser, int, Callable, int) -> Any
    """"""
    expect(parser, open_kind)
    nodes = []
    while not skip(parser, close_kind):
        nodes.append(parse_fn(parser))

    return nodes
1028262
def each_resource(type)
            target = self.is_a?(Resources) ? self : (self.Resources ||= Resources.new)

            rsrc = (target[type] and target[type].solve)

            return enum_for(__method__, type) { rsrc.is_a?(Dictionary) ? rsrc.length : 0 } unless block_given?
            return unless rsrc.is_a?(Dictionary)

            rsrc.each_pair do |name, obj|
                yield(name.value, obj.solve)
            end
        end
1282572
def each
      unless block_given?
        return self.enum_for(:each)
      else
        while @parser.has_next?
          event = @parser.pull
          # if it's the start of a record element 
          if event.start_element? and strip_ns(event[0]) == 'record'
            yield build_record
          end
        end    
      end
    end
13373
def recursive_children
      self.children.each do |child|
        if Parser::AST::Node === child
          yield child
          child.recursive_children { |c| yield c }
        end
      end
    end
120791
def iter_ancestors(self):
        
        node = self
        while node.up is not None:
            yield node.up
            node = node.up
125977
def each_element(path, elements)
      elements = Array(elements)
      Nokogiri::XML::Reader(::File.open(path, 'rb'), nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS).each do |node|
        next unless node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT && elements.include?(node.name)
        yield Nokogiri::XML(node.outer_xml).root if block_given?
      end
    end
931980
def filtered_elements(self, model):
        """"""
        if isinstance(model, self.element_type):
            yield model
        yield from (e for e in model.eAllContents() if isinstance(e, self.element_type))
82150
def visit_Yield(self, node):
        
        self.generic_visit(node)
        self.combine(self.current, node.value)
792543
def nilled(self, elt, ps):
        '''
        '''
        if _find_nil(elt) not in [ "true",  "1"]: return False
        if self.nillable is False:
            raise EvaluateException('Non-nillable element is NIL',
                    ps.Backtrace(elt))
        return True