Turn all string indices into int indices, preserving ellipsis.
496303
def _indices(self, indices):
    """"""
    if isinstance(indices, tuple):
      out = []
      dim = 0
      for i, index in enumerate(indices):
        if index is Ellipsis:
          out.append(index)
          dim = len(self.shape) - len(indices) + i
        else:
          out.append(self._get_index(dim, index))
        dim += 1
      return tuple(out)
    else:
      return self._get_index(0, indices)
1057923
def coerce_to_indices(self, nodes):
        
        if nodes is None:
            return self.node_indices

        if all(isinstance(node, str) for node in nodes):
            indices = self.labels2indices(nodes)
        else:
            indices = map(int, nodes)
        return tuple(sorted(set(indices)))
838816
def to_python_index(self, length, check_bounds=True, circular=False):
        
        if not self.is_unitless:
            raise ValueError("Index cannot have units: {0!r}".format(self))

        ret = int(self.value)
        if ret != self.value:
            raise ValueError("Index must be an integer: {0!r}".format(ret))

        if ret == 0:
            raise ValueError("Index cannot be zero")

        if check_bounds and not circular and abs(ret) > length:
            raise ValueError("Index {0!r} out of bounds for length {1}".format(ret, length))

        if ret > 0:
            ret -= 1

        if circular:
            ret = ret % length

        return ret
1212313
def _normalize_index(self, index, pipe=None):
        """"""
        pipe = self.redis if pipe is None else pipe
        len_self = self.__len__(pipe)
        positive_index = index if index >= 0 else len_self + index

        return len_self, positive_index
132889
private String[] convertIndsToLabels(int... ind)
	{
		String[] label = new String[ind.length];
		for (int i = 0; i < ind.length; i++)
		{
			if (!hasLabel(ind[i])) throw new IllegalArgumentException(
				"The index " + ind[i] + " does not have a label.");

			label[i] = getLabel(ind[i]);
		}
		return label;
	}
867556
def _idx_to_bits(self, i):
    """"""
    bits = bin(i)[2:].zfill(self.nb_hyperplanes)  # Pad the bits str with 0
    return [-1.0 if b == "0" else 1.0 for b in bits]
850926
def normalize_index(index):
    """"""
    index = np.asarray(index)
    
    if len(index) == 0:
        return index.astype('int')
    
    if index.dtype == 'bool':
        index = index.nonzero()[0]
    elif index.dtype == 'int':
        pass
    else:
        raise ValueError('Index should be either integer or bool')
    return index
555989
private int[] findIndices(final Literal literal) {

        int count = 0;
        final char s = literal.getFirstChar();
        for (int i = 0; i < myChars.length; i++) {

            // Check the first char for better performance and check the complete string
            if ((myChars[i] == s || s == '?') && literal.matches(myChars, i)) {

                // This index matches
                myBuffer[count] = i;
                count++;
            }
        }

        // Check whether any match has been found
        if (count == 0) {
            return EMPTY;
        }

        // Use an existing array
        if (count == 1 && myBuffer[0] < SINGLE_VALUES.length) {
            final int index = myBuffer[0];
            return SINGLE_VALUES[index];
        }

        // Copy the values
        final int[] values = new int[count];
        for (int i = 0; i < count; i++) {
            values[i] = myBuffer[i];
        }
        return values;
    }
444982
def str_to_int_array(string, base=16):
    

    int_strings = string.split()
    return [int(int_str, base) for int_str in int_strings]
504579
def labels_to_indices(self, labels: Sequence[str]) -> List[int]:
        

        return [self.LABEL_TO_INDEX[label] for label in labels]
1372963
def eval_str_to_list(input_str: str) -> List[str]:
    """"""
    inner_cast = ast.literal_eval(input_str)  # type: List[str]
    if isinstance(inner_cast, list):
        return inner_cast
    else:
        raise ValueError
694472
def get_int(strings: Sequence[str],
            prefix: str,
            ignoreleadingcolon: bool = False,
            precedingline: str = "") -> Optional[int]:
    
    return get_int_raw(get_string(strings, prefix,
                                  ignoreleadingcolon=ignoreleadingcolon,
                                  precedingline=precedingline))
580932
def parse_int_string(int_string: str) -> List[int]:
    
    cleaned = " ".join(int_string.strip().split())
    cleaned = cleaned.replace(" - ", "-")
    cleaned = cleaned.replace(",", " ")

    tokens = cleaned.split(" ")
    indices: Set[int] = set()
    for token in tokens:
        if "-" in token:
            endpoints = token.split("-")
            if len(endpoints) != 2:
                LOG.info(f"Dropping '{token}' as invalid - weird range.")
                continue

            start = int(endpoints[0])
            end = int(endpoints[1]) + 1

            indices = indices.union(indices, set(range(start, end)))

        else:
            try:
                indices.add(int(token))
            except ValueError:
                LOG.info(f"Dropping '{token}' as invalid - not an int.")

    return list(indices)
993077
def reconstruct_indices(self):
        
        del self.i2f, self.f2i
        self.f2i, self.i2f = {}, {}

        for i, w in enumerate(self.words):
            self.f2i[w] = i
            self.i2f[i] = w
658608
def numericise_all(input, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False):
    """"""
    return [numericise(s, empty2zero, default_blank, allow_underscores_in_numeric_literals) for s in input]
2186
def indices_to_labels(self, indices: Sequence[int]) -> List[str]:
        

        return [(self.INDEX_TO_LABEL[index]) for index in indices]
1097761
def get_indices(s: Union[str, 'ChainedBase']) -> Dict[int, str]:
    
    codes = get_code_indices(s)
    if not codes:
        # This function is not for non-escape-code stuff, but okay.
        return {i: c for i, c in enumerate(s)}

    indices = {}
    for codeindex in sorted(codes):
        code = codes[codeindex]
        if codeindex == 0:
            indices[codeindex] = code
            continue
        # Grab characters before codeindex.
        start = max(indices or {0: ''}, key=int)
        startcode = indices.get(start, '')
        startlen = start + len(startcode)
        indices.update({i: s[i] for i in range(startlen, codeindex)})
        indices[codeindex] = code

    if not indices:
        return {i: c for i, c in enumerate(s)}
    lastindex = max(indices, key=int)
    lastitem = indices[lastindex]
    start = lastindex + len(lastitem)
    textlen = len(s)
    if start < (textlen - 1):
        # Grab chars after last code.
        indices.update({i: s[i] for i in range(start, textlen)})
    return indices