Displays or updates a console progress bar. Original source: https://stackoverflow.com/a/15860757/1391441
(total, progress)
| 93 | |
| 94 | |
| 95 | def progress_bar(total, progress): |
| 96 | """ |
| 97 | Displays or updates a console progress bar. |
| 98 | |
| 99 | Original source: https://stackoverflow.com/a/15860757/1391441 |
| 100 | """ |
| 101 | initial_progress = progress |
| 102 | bar_length = 20 |
| 103 | progress = progress / total |
| 104 | block = int(round(bar_length * progress)) |
| 105 | progress_bar_str = '#' * block + '-' * (bar_length - block) |
| 106 | text = '\r[{progress_bar}] {percent:.0f}% {item}/{total}'.format( |
| 107 | progress_bar=progress_bar_str, |
| 108 | percent=round(progress * 100, 0), |
| 109 | item=initial_progress, |
| 110 | total=total) |
| 111 | sys.stderr.write(text) |
| 112 | if progress == 1: |
| 113 | sys.stderr.write('\n') |
| 114 | sys.stderr.flush() |
| 115 | |
| 116 | |
| 117 | def download_mwm_list(version=None, threads=8, folder=None, countries_path=COUNTRIES_TXT, mwm_prefix_list=None, quiet=True): |
no test coverage detected