-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogress.py
More file actions
50 lines (41 loc) · 1.46 KB
/
progress.py
File metadata and controls
50 lines (41 loc) · 1.46 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import tqdm
from tqdm.notebook import trange
import numpy as np
import time
def bsar(n):
for i in range(n):
bar = '■'*i + "."*(n-i)
print(f"\r\033[K[\033[33m{bar}\033[39m] {i/n*100:.02f}% ({i}/{n})", end="")
time.sleep(0.5)
def new_progress(long, slp=1):
"""
Explain:
This function creates a progress bar.
If you're jupyter user, you can use jupyter_progress func.
Args:
parameter1 (int) : This parameter must be set. (Func name: long)
This is length of the progress bar.
parameter2 (float, int): You do not need to set this parameter. (Func name: slp)
Default value is 1.
This is the time per progress. (Unit: seconds)
Return:
None
"""
for i in tqdm.tqdm(range(int(long))):
time.sleep(slp)
def jupyter_progress(long, slp=1):
"""
Explain:
This function creates a progress bar.
※If you're not jupyter user, you mustn't use jupyter_progress func.
Args:
parameter1 (int) : This parameter must be set. (Func name: long)
This is length of the progress bar.
parameter2 (float, int): You do not need to set this parameter. (Func name: slp)
Default value is 1.
This is the time per progress. (Unit: seconds)
Return:
None
"""
for i in trange(long, leave=False):
time.sleep(slp)