Find the index based on various strategies for a node, probably an input or output of chain. Supported
        inputs are indexes, node values or names.
342812
def _resolve_index(self, mixed):
        
        if mixed is None:
            return None

        if type(mixed) is int or mixed in self.edges:
            return mixed

        if isinstance(mixed, str) and mixed in self.named:
            return self.named[mixed]

        if mixed in self.nodes:
            return self.nodes.index(mixed)

        raise ValueError("Cannot find node matching {!r}.".format(mixed))
581166
function resolveNodeSkel(index, nodeName) {
    var idx = +graph.nameToIndex[nodeName];
    argh = [idx, +index]
    if(Number.isNaN(idx)) {
      throw "Unable to get index for node '" + nodeName + "'. (Is the node name misspelled?)";
    }
    if(index !== undefined && idx > +index) {
      throw "Unable to get index for node '" + nodeName + "'. (Are the nodes out of order?)";
    }
    if(index !== undefined && idx == +index) {
      throw "Unable to get index for node '" + nodeName + "'. (Is the node trying to reference itself?)";
    }
    return (dataContext) => dataContext.values[idx];
  }
149829
def find_for_x_in_y_keys(node):
    """"""
    return (
        isinstance(node, ast.For)
        and h.call_name_is(node.iter, 'keys')
    )
661729
function indexOfNode (host, node) {
  const chs = host.childNodes;
  const chsLen = chs.length;
  for (let a = 0; a < chsLen; a++) {
    if (chs[a] === node) {
      return a;
    }
  }
  return -1;
}
648212
def _find_line_start_index(self, index):
        
        indexes = self._line_start_indexes

        pos = bisect.bisect_right(indexes, index) - 1
        return pos, indexes[pos]
1166230
def AddIndex(node, index=None):
  
  if isinstance(node, list):
    for i, item in enumerate(node):
      AddIndex(item, index=i)
  elif isinstance(node, dict):
    if index is not None:
      node['index'] = index
    for key in node:
      AddIndex(node[key])
1054460
def getNodeByNameChain(node, chain_list):
    

    working_list = chain_list[:]
    working_list.reverse()
    current_node = node
    while len(working_list):
        current_name = working_list.pop()
        child_node = getNodeByName(current_node, current_name)
        if child_node is None:
            raise Exception("Unable to find child node %s" % current_name)
        current_node = child_node
    return current_node
742388
def find_focusable(node):
    

    if not node.children:
        return node

    if node.focus:
        return find_focusable(node.children_dict[node.focus[0]])
252262
def _indices(self):
        """"""
        path = self.parent
        layer = path.parent
        for path_index in range(len(layer.paths)):
            if path == layer.paths[path_index]:
                for node_index in range(len(path.nodes)):
                    if self == path.nodes[node_index]:
                        return Point(path_index, node_index)
        return None
252974
def get_node_index(self, node):
        

        if node == self.__root_node:
            return QModelIndex()
        else:
            row = node.row()
            return self.createIndex(row, 0, node) if row is not None else QModelIndex()
1057627
def get_chain(self, index):
        
        chain = []
        this = self.leaves[index]
        chain.append((this.val, 'SELF'))
        while this.p:
            chain.append((this.sib.val, this.sib.side))
            this = this.p
        chain.append((this.val, 'ROOT'))
        return chain
476173
function getNodeIndex(node) {
	var ret = 0;
	while (node.previousSibling) {
		ret++;
		node = node.previousSibling;
	}
	return ret;
}
271198
def analyze(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.analyze(index=self._name, **kwargs)
651662
def cycle_outputs(tree, direction):
    
    direction = 1 if direction == "next" else -1
    outputs = [output for output in tree.root.children
               if output.name != "__i3"]
    focus_idx = outputs.index(tree.root.focused_child)
    next_idx = (focus_idx + direction) % len(outputs)
    next_output = outputs[next_idx]
    return find_focusable(next_output)
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
209878
def createManualIndex(self, indexName, indexClass):
        """"""
        indexClass = str(indexClass).lower()
        if indexClass == "vertex":
            index = self.neograph.nodes.indexes.create(indexName)
        elif indexClass == "edge":
            index = self.neograph.relationships.indexes.create(indexName)
        else:
            NameError("Unknown Index Class %s" % indexClass)
        return Index(indexName, indexClass, "manual", index)
744581
def _checkAndConvertIndex(self, index):
        
        if index < 0:
            index = len(self) + index
        if index < 0 or index >= self._doc.blockCount():
            raise IndexError('Invalid block index', index)
        return index