import sys


class Progress(object):
    _strsize = 0
    _note_size = 0

    def __init__(self, max_index, bar_size=21):
        self.total = max_index
        # bar size in symbols
        self.bar_size = bar_size

    def write_progress(self, index, note=''):
        # calc index and percent values
        _suffix = ''
        new_size = len(note)
        if self._note_size > new_size:
            _suffix = ' '*(self._note_size - new_size)
        _percent = (100 * index) / self.total
        _index = (self.bar_size * index) / self.total
        # clear the line
        sys.stdout.write('\r')
        # print new progress
        _format = "[{:"+str(self.bar_size-1)+"}] {}/{} ({}%) {}"
        _progress_string = _format.format(
            '='*_index,
            index,
            self.total,
            _percent,
            note + _suffix
        )
        sys.stdout.write(_progress_string)
        # Save new note size and whole string size
        self._strsize = len(_progress_string)
        self._note_size = new_size
        sys.stdout.flush()

    def clearline(self):
        sys.stdout.write('\r')
        sys.stdout.write(' '*self._strsize)
        sys.stdout.write('\r')

    def end(self):
        self._note_size = 0
        self._strsize = 0
        sys.stdout.write('\n')
