-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathdata_size.py
More file actions
26 lines (18 loc) · 712 Bytes
/
Copy pathdata_size.py
File metadata and controls
26 lines (18 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""``DataSize`` shows a single byte count scaled with binary prefixes.
Reach for it to show an amount of data transferred or processed so far
-- "12.5 MiB" instead of a raw byte count -- as one value scaled to a
sensible unit. Compare ``FileTransferSpeed``, which shows a *rate*
instead of a static amount.
"""
import time
import progressbar
STEPS = 24
def main() -> None:
widgets = [progressbar.DataSize(), ' ', progressbar.Bar()]
max_value = 12_500_000
with progressbar.ProgressBar(max_value=max_value, widgets=widgets) as bar:
for step in range(STEPS):
bar.update(int(max_value * (step + 1) / STEPS))
time.sleep(0.005)
if __name__ == '__main__':
main()