Generator over all possible blackboxings of these indices.

    Args:
        indices (tuple[int]): Nodes to blackbox.

    Yields:
        Blackbox: The next |Blackbox| of ``indices``.
762560
def all_blackboxes(indices):
    
    for partition in all_partitions(indices):
        # TODO? don't consider the empty set here
        # (pass `nonempty=True` to `powerset`)
        for output_indices in utils.powerset(indices):
            blackbox = Blackbox(partition, output_indices)
            try:  # Ensure every box has at least one output
                validate.blackbox(blackbox)
            except ValueError:
                continue
            yield blackbox
739034
def get_next_index(self, matrix, manipulation, indices_left):
        
        f = manipulation[0]
        indices = list(indices_left.intersection(manipulation[2]))
        sums = np.sum(matrix[indices], axis=1)
        if f < 1:
            next_index = indices[sums.argmax(axis=0)]
        else:
            next_index = indices[sums.argmin(axis=0)]

        return next_index
2186
def indices_to_labels(self, indices: Sequence[int]) -> List[str]:
        

        return [(self.INDEX_TO_LABEL[index]) for index in indices]
628315
def xselections(items, n):
    
    if n==0:
        yield []
    else:
        for i in xrange(len(items)):
            for ss in xselections(items, n-1):
                yield [items[i]]+ss
865419
def iteritems(self, indices=None):
        ''
        if indices is None:
            indices = force_list(self.indices.keys())
        for x in self.itervalues(indices):
            yield x
757889
def generate_matches(self, nodes):
        
        r = {}
        if nodes and self.match(nodes[0], r):
            yield 1, r
1064762
def distribute_batches(self, indices):
        
        assert len(indices) == self.num_samples

        indices = indices.view(-1, self.batch_size)
        indices = indices[self.rank::self.world_size].contiguous()
        indices = indices.view(-1)
        indices = indices.tolist()

        assert len(indices) == self.num_samples // self.world_size
        return indices
402825
def convert_from_missing_indexer_tuple(indexer, axes):
    

    def get_indexer(_i, _idx):
        return (axes[_i].get_loc(_idx['key']) if isinstance(_idx, dict) else
                _idx)

    return tuple(get_indexer(_i, _idx) for _i, _idx in enumerate(indexer))
976348
def outputs_of(self, partition_index):
        
        partition = self.partition[partition_index]
        outputs = set(partition).intersection(self.output_indices)
        return tuple(sorted(outputs))
657146
def getBigIndexFromIndices(self, indices):
        
        return reduce(operator.add, [self.dimProd[i]*indices[i]
                                     for i in range(self.ndims)], 0)
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)))
678269
def indices(self, data):
        '''
        '''
        duration = self.data_duration(data)

        while True:
            # Generate a sampling interval
            yield self.rng.randint(0, duration - self.min_duration + 1)
185632
def _expand_slice(self, indices):
        
        keys = list(self.data.keys())
        expanded = []
        for idx, ind in enumerate(indices):
            if isinstance(ind, slice) and ind.step is not None:
                dim_ind = slice(ind.start, ind.stop)
                if dim_ind == slice(None):
                    condition = self._all_condition()
                elif dim_ind.start is None:
                    condition = self._upto_condition(dim_ind)
                elif dim_ind.stop is None:
                    condition = self._from_condition(dim_ind)
                else:
                    condition = self._range_condition(dim_ind)
                dim_vals = unique_iterator(k[idx] for k in keys)
                expanded.append(set([k for k in dim_vals if condition(k)][::int(ind.step)]))
            else:
                expanded.append(ind)
        return tuple(expanded)
1299508
def yield_pair_energies(self, index1, index2):
        """"""
        A = self.As[index1, index2]
        B = self.Bs[index1, index2]
        distance = self.distances[index1, index2]
        yield A*np.exp(-B*distance), 1
800897
def rows(self):
        

        yield [self.index.name] + list(self.columns)

        for t in self.itertuples():
            yield list(t)
1165381
def glitch_with_index target = :all, &block  # :yield: data, index
      if block_given?
        self.glitch(target).with_index do |x, i|
          yield x, i
        end
        self
      else
        self.glitch target
      end
    end
88441
def labels(indices, node_labels=None):
    """"""
    if node_labels is None:
        return tuple(map(str, indices))
    return node_labels.indices2labels(indices)