From 2c6c3a1ca31986647b52a6db7d3787ed2c9c2551 Mon Sep 17 00:00:00 2001 From: taizan-hokuto <55448286+taizan-hokuto@users.noreply.github.com> Date: Mon, 7 Sep 2020 23:30:49 +0900 Subject: [PATCH] Delete old progress bar --- pytchat/cli/progressbar.py | 54 -------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 pytchat/cli/progressbar.py diff --git a/pytchat/cli/progressbar.py b/pytchat/cli/progressbar.py deleted file mode 100644 index b61d6bc..0000000 --- a/pytchat/cli/progressbar.py +++ /dev/null @@ -1,54 +0,0 @@ -''' -This code for this progress bar is based on -vladignatyev/progress.py -https://gist.github.com/vladignatyev/06860ec2040cb497f0f3 -(MIT License) -''' -import sys - -ROT = ['\u25F4', '\u25F5', '\u25F6', '\u25F7'] - - -class ProgressBar: - def __init__(self, total, status): - self._bar_len = 60 - self._cancelled = False - self.reset(total=total, status=status) - self._blinker = 0 - - def reset(self, symbol_done="=", symbol_space=" ", total=100, status=''): - self._symbol_done = symbol_done - self._symbol_space = symbol_space - self._total = total - self._status = status - self._count = 0 - - def _disp(self, _, fetched): - self._progress(fetched, self._total) - - def _progress(self, fillin, total): - if total == 0 or self._cancelled: - return - self._count += fillin - filled_len = int(round(self._bar_len * self._count / float(total))) - percents = round(100.0 * self._count / float(total), 1) - if percents > 100: - percents = 100.0 - if filled_len > self._bar_len: - filled_len = self._bar_len - - bar = self._symbol_done * filled_len + \ - self._symbol_space * (self._bar_len - filled_len) - sys.stdout.write(' [%s] %s%s ...%s %s \r' % (bar, percents, '%', self._status, ROT[self._blinker % 4])) - sys.stdout.flush() - self._blinker += 1 - - def close(self): - if not self._cancelled: - self._progress(self._total, self._total) - - def cancel(self): - self._cancelled = True - - def is_cancelled(self): - return self._cancelled