sample_data_utils/utils.py
def sequence(prefix, cache=None):
    """
    generator that returns an unique string

    :param prefix: prefix of string
    :param cache: cache used to store the last used number

    >>> next(sequence('abc'))
    'abc-0'
    >>> next(sequence('abc'))
    'abc-1'
    """
    if cache is None:
        cache = _sequence_counters
    if cache == -1:
        cache = {}

    if prefix not in cache:
        cache[prefix] = infinite()

    while cache[prefix]:
        yield "{0}-{1}".format(prefix, next(cache[prefix]))
def sequence(prefix, cache=None):
    if cache is None:
        cache = _sequence_counters
    if cache == -1:
        cache = {}

    if prefix not in cache:
        cache[prefix] = infinite()

    while cache[prefix]:
        yield "{0}-{1}".format(prefix, next(cache[prefix]))
def sequence ( prefix , cache = None ) : if cache is None : cache = _sequence_counters if cache == - 1 : cache = { } if prefix not in cache : cache [ prefix ] = infinite ( ) while cache [ prefix ] : yield "{0}-{1}" . format ( prefix , next ( cache [ prefix ] ) )
generator that returns an unique string

    :param prefix: prefix of string
    :param cache: cache used to store the last used number

    >>> next(sequence('abc'))
    'abc-0'
    >>> next(sequence('abc'))
    'abc-1'
generator that returns an unique string