def format_meter(n_finished, n_total, elapsed, error=None):
    """ Format meter.
    Parameters
    ----------
    n_finished : int
        Number of finished iterations.
    n_total : int or None
        Total number of iterations.
    elapsed : int
        Number of seconds passed since start
    """
    if n_finished > n_total:
        n_total = None

    elapsed_str = format_interval(elapsed)

    if n_total is not None:
        frac = float(n_finished) / n_total

        n_bars = 10
        bar_length = int(frac * n_bars)
        bar = '#' * bar_length + '-' * (n_bars - bar_length)

        percentage = '%3d%%' % (frac * 100)

        left_str = format_interval(
            elapsed / n_finished * (n_total - n_finished)
        ) if n_finished else '?'

        return '|{}| {}/{} {} [elapsed: {} left: {} error: {}]'.format(
            bar, n_finished, n_total, percentage,
            elapsed_str, left_str, format_error(error)
        )

    return '{} [elapsed: {}]'.format(n_finished, elapsed_str)
dataset/ETHPy150Open itdxer/neupy/neupy/helpers/progressbar.py/format_meter/original