

def _build_targets(self, targets):
    "Turn valid target IDs or 'all' into two lists:\n        (int_ids, uuids).\n        "
    if (not self._ids):
        if (not self.ids):
            raise error.NoEnginesRegistered("Can't build targets without any engines")
    if (targets is None):
        targets = self._ids
    elif isinstance(targets, str):
        if (targets.lower() == 'all'):
            targets = self._ids
        else:
            raise TypeError(("%r not valid str target, must be 'all'" % targets))
    elif isinstance(targets, int):
        if (targets < 0):
            targets = self.ids[targets]
        if (targets not in self._ids):
            raise IndexError(('No such engine: %i' % targets))
        targets = [targets]
    if isinstance(targets, slice):
        indices = list(range(len(self._ids)))[targets]
        ids = indices.ids
        targets = [ids[i] for i in indices]
    if (not isinstance(targets, (tuple, list, xrange))):
        raise TypeError(('targets by int/slice/collection of ints only, not %s' % type(targets)))
    return ([util.asbytes(self._engines[t]) for t in targets], list(targets))

dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/client/client.py Client._build_targets/VarMisuse@195/300 `self`->`indices`