Search for a local node, return <tt>Node::*</tt> or <tt>nil</tt>.

   find_node(:hello)                   # Search at root.
   find_node(:hello, :parent => grp)   # Search in `grp` group.

 See also: #find_node.
19826
def find_local_node(name, parent)
      @nodes.find {|r| r.name == name.to_sym and r.parent == parent}
    end
294052
function search(root, test, skip, callback) {
  var index = -1
  var children = root.children
  var length = children.length
  var depth = null
  var start = null
  var end = null
  var nodes
  var clean
  var child

  while (++index < length) {
    child = children[index]

    if (closing(child, depth)) {
      end = index
      break
    }

    if (opening(child, depth, test)) {
      start = index
      depth = child.depth
    }
  }

  if (start !== null) {
    if (end === null) {
      end = length
    }

    if (skip) {
      while (end > start) {
        child = children[end - 1]

        if (!definition(child)) {
          break
        }

        end--
      }
    }

    nodes = callback(
      children[start],
      children.slice(start + 1, end),
      children[end],
      {
        parent: root,
        start: start,
        end: children[end] ? end : null
      }
    )

    clean = []
    index = -1
    length = nodes && nodes.length

    // Ensure no empty nodes are inserted.  This could be the case if `end` is
    // in `nodes` but no `end` node exists.
    while (++index < length) {
      if (nodes[index]) {
        clean.push(nodes[index])
      }
    }

    if (nodes) {
      splice.apply(children, [start, end - start + 1].concat(clean))
    }
  }
}
173140
def __discover_node(self, node, depth):
        '''
        
        '''
        if (node == None):
            return

        if (depth >= self.max_depth):
            return

        if (node.discovered > 0):
            return
        node.discovered = 1

        # vmware ESX can report IP as 0.0.0.0
        # If we are allowing 0.0.0.0/32 in the config,
        # then we added it as a leaf, but don't discover it
        if (node.ip[0] == '0.0.0.0'):
            return

        # may be a leaf we couldn't connect to previously
        if (node.snmpobj.success == 0):
            return

        # print some info to stdout
        dcodes = DCODE_STEP_INTO
        if (depth == 0):
            dcodes |= DCODE_ROOT
        self.__print_step(node.ip[0], node.name, depth, dcodes)

        # get the cached snmp credentials
        snmpobj = node.snmpobj

        # list of valid neighbors to discover next
        valid_neighbors = []

        # get list of neighbors
        cdp_neighbors  = node.get_cdp_neighbors()
        lldp_neighbors = node.get_lldp_neighbors()
        neighbors      = cdp_neighbors + lldp_neighbors
        if (len(neighbors) == 0):
            return

        for n in neighbors:
            # some neighbors may not advertise IP addresses - default them to 0.0.0.0
            if (n.remote_ip == None):
                n.remote_ip = '0.0.0.0'

            # check the ACL
            acl_action = self.__match_node_acl(n.remote_ip, n.remote_name)
            if (acl_action == 'deny'):
                # deny inclusion of this node
                continue
            
            dcodes = DCODE_DISCOVERED
            child = None
            if (acl_action == 'include'):
                # include this node but do not discover it
                child    = natlas_node()
                child.ip = [n.remote_ip]
                dcodes  |= DCODE_INCLUDE
            else:
                # discover this node
                child, query_result = self.__query_node(n.remote_ip, n.remote_name)

            # if we couldn't pull info from SNMP fill in what we know
            if (child.snmpobj.success == 0):
                child.name = util.shorten_host_name(n.remote_name, self.config.host_domains)
                dcodes  |= DCODE_ERR_SNMP
            
            # need to check the ACL again for extended ops (we have more info)
            acl_action = self.__match_node_acl(n.remote_ip, n.remote_name, n.remote_plat, n.remote_ios, child.serial)
            if (acl_action == 'deny'):
                continue

            if (query_result == NODE_NEW):
                self.nodes.append(child)
                if (acl_action == 'leaf'):          dcodes |= DCODE_LEAF
                if (n.discovered_proto == 'cdp'):   dcodes |= DCODE_CDP
                if (n.discovered_proto == 'lldp'):  dcodes |= DCODE_LLDP
                self.__print_step(n.remote_ip, n.remote_name, depth+1, dcodes)

            # CDP/LLDP advertises the platform
            child.plat = n.remote_plat
            child.ios  = n.remote_ios
            
            # add the discovered node to the link object and link to the parent
            n.node = child
            self.__add_link(node, n)

            # if we need to discover this node then add it to the list
            if ((query_result == NODE_NEW) & (acl_action != 'leaf') & (acl_action != 'include')):
                valid_neighbors.append(child)

        # discover the valid neighbors
        for n in valid_neighbors:
            self.__discover_node(n, depth+1)
944427
function findPrevRowNode(node){
	var i, last, prev,
		parent = node.parent,
		siblings = parent ? parent.children : null;

	if(siblings && siblings.length > 1 && siblings[0] !== node){
		// use the lowest descendant of the preceeding sibling
		i = $.inArray(node, siblings);
		prev = siblings[i - 1];
		_assert(prev.tr);
		// descend to lowest child (with a <tr> tag)
		while(prev.children){
			last = prev.children[prev.children.length - 1];
			if(!last.tr){
				break;
			}
			prev = last;
		}
	}else{
		// if there is no preceding sibling, use the direct parent
		prev = parent;
	}
	return prev;
}
923388
def find_node(self, x: int, y: int) -> Optional["BSP"]:
        
        if not self.contains(x, y):
            return None
        for child in self.children:
            found = child.find_node(x, y)  # type: Optional["BSP"]
            if found:
                return found
        return self
974234
def findNode(self, node):
        
        ident = self.getRawIdent(node)
        if ident is None:
            ident = node
        try:
            return self.graph.node_data(ident)
        except KeyError:
            return None
1300074
def _element_find_from_root(
        root,  # type: ET.Element
        element_path  # type: Text
):
    # type: (...) -> Optional[ET.Element]
    
    element = None

    element_names = element_path.split('/')
    if element_names[0] == root.tag:
        if len(element_names) > 1:
            element = root.find('/'.join(element_names[1:]))
        else:
            element = root

    return element
280343
def find_child_element(elm, child_local_name):
    
    for n in range(len(elm)):
        child_elm = elm[n]
        tag = etree.QName(child_elm)
        if tag.localname == child_local_name:
            return child_elm
    return None
1067466
function find_node(context, path, callback) {
  path = normalize(path);
  if(!path) {
    return callback(new Errors.ENOENT('path is an empty string'));
  }
  var name = basename(path);
  var parentPath = dirname(path);
  var followedCount = 0;

  function read_root_directory_node(error, nodeData) {
    if(error) {
      return callback(error);
    }

    // Parse existing node as SuperNode
    const superNode = new SuperNode(nodeData);

    if(!superNode || superNode.type !== NODE_TYPE_META || !superNode.rnode) {
      callback(new Errors.EFILESYSTEMERROR());
    } else {
      context.getObject(superNode.rnode, check_root_directory_node);
    }
  }

  function check_root_directory_node(error, rootDirectoryNode) {
    if(error) {
      callback(error);
    } else if(!rootDirectoryNode) {
      callback(new Errors.ENOENT());
    } else {
      Node.create(rootDirectoryNode, callback);
    }
  }

  // in: parent directory node
  // out: parent directory data
  function read_parent_directory_data(error, parentDirectoryNode) {
    if(error) {
      callback(error);
    } else if(parentDirectoryNode.type !== NODE_TYPE_DIRECTORY || !parentDirectoryNode.data) {
      callback(new Errors.ENOTDIR('a component of the path prefix is not a directory', path));
    } else {
      context.getObject(parentDirectoryNode.data, get_node_from_parent_directory_data);
    }
  }

  // in: parent directory data
  // out: searched node
  function get_node_from_parent_directory_data(error, parentDirectoryData) {
    if(error) {
      callback(error);
    } else {
      if(!parentDirectoryData.hasOwnProperty(name)) {
        callback(new Errors.ENOENT(null, path));
      } else {
        var nodeId = parentDirectoryData[name].id;
        context.getObject(nodeId, create_node);
      }
    }
  }

  function create_node(error, data) {
    if(error) {
      return callback(error);
    }
    Node.create(data, is_symbolic_link);
  }

  function is_symbolic_link(error, node) {
    if(error) {
      callback(error);
    } else {
      if(node.type === NODE_TYPE_SYMBOLIC_LINK) {
        followedCount++;
        if(followedCount > SYMLOOP_MAX){
          callback(new Errors.ELOOP(null, path));
        } else {
          follow_symbolic_link(node.data);
        }
      } else {
        callback(null, node);
      }
    }
  }

  function follow_symbolic_link(data) {
    data = normalize(data);
    parentPath = dirname(data);
    name = basename(data);
    if(ROOT_DIRECTORY_NAME === name) {
      context.getObject(SUPER_NODE_ID, read_root_directory_node);
    } else {
      find_node(context, parentPath, read_parent_directory_data);
    }
  }

  if(ROOT_DIRECTORY_NAME === name) {
    context.getObject(SUPER_NODE_ID, read_root_directory_node);
  } else {
    find_node(context, parentPath, read_parent_directory_data);
  }
}
640903
def get_node(self, index):
        

        index = self.mapToSource(index)
        if not index.isValid():
            return self.sourceModel().root_node

        return index.internalPointer() or self.sourceModel().root_node
408762
def traverse(self, node):
    
    self.find_replace(node)

    for c in node.children:
      self.traverse(c)
387840
private Node findNode(String id) {
        Node result = doFindNode(id);
        if (result != null) {
            return result;
        }
        throw new IllegalArgumentException("Couldn't find node " + id);
    }
926160
def find_node(results, node_name)
      document = ::Nokogiri::XML(results.body)
      document.remove_namespaces!
      document.xpath("//#{node_name}").first
    end
410273
def node_query(self, node):
        

        if isinstance(node, ast.Call):
            assert node.args
            arg = node.args[0]
            if not isinstance(arg, ast.Str):
                return
        else:
            raise TypeError(type(node))

        return arg.s
1343820
def _get_node(self, treelist, pos):
        
        node = None
        if pos is not None:
            subtree = self._get_substructure(treelist, pos)
            if subtree is not None:
                node = subtree[0]
        return node
698495
def select(self, node):
        

        child_object = self.translate(node.child)
        where_block = node.conditions
        if child_object.where_block:
              where_block = '({0}) AND ({1})'\
                  .format(child_object.where_block, node.conditions)
        child_object.where_block = where_block
        if not child_object.select_block:
            child_object.select_block = str(node.attributes)
        return child_object
298777
public Tree findHead(Tree parentNode) {
        Tree cursor = parentNode.getType().equals("TOP") ? parentNode.firstChild() : parentNode;

        while (cursor.children() != null && !cursor.children().isEmpty())
            cursor = findHead2(cursor);

        return cursor;
    }