MCPcopy Create free account
hub / github.com/comaps/comaps / progress_bar

Function progress_bar

tools/python/mwm_downloader.py:95–114  ·  view source on GitHub ↗

Displays or updates a console progress bar. Original source: https://stackoverflow.com/a/15860757/1391441

(total, progress)

Source from the content-addressed store, hash-verified

93
94
95def 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
117def download_mwm_list(version=None, threads=8, folder=None, countries_path=COUNTRIES_TXT, mwm_prefix_list=None, quiet=True):

Callers 1

download_mwm_listFunction · 0.85

Calls 2

formatMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected