def _n_colors(n, bytes_=False, cmap='hsv'):
    n_max = 2 ** 10
    if n > n_max:
        raise NotImplementedError("Can't produce more than %i unique "
                                  "colors" % n_max)

    from matplotlib.cm import get_cmap
    cm = get_cmap(cmap, n_max)
    pos = np.linspace(0, 1, n, False)
    colors = cm(pos, bytes=bytes_)
    if bytes_:
        # make sure colors are unique
        for ii, c in enumerate(colors):
            if np.any(np.all(colors[:ii] == c, 1)):
                raise RuntimeError('Could not get %d unique colors from %s '
                                   'colormap. Try using a different colormap.'
                                   % (n, cmap))
    return colors
Return a list of unique values in job_configs filtered by func().
dataset/ETHPy150Open mne-tools/mne-python/mne/label.py/_n_colors--crossover with--dataset/ETHPy150Open openstack/sahara/sahara/service/edp/job_utils.py/_data_source_ref_search