Spaces:
Runtime error
Runtime error
Update utils/timing.py
Browse files- utils/timing.py +10 -3
utils/timing.py
CHANGED
@@ -4,7 +4,9 @@ from os import environ
|
|
4 |
|
5 |
class Timer():
|
6 |
total = 0
|
|
|
7 |
expander = None
|
|
|
8 |
def __init__(self, pt_name, en_name):
|
9 |
self.pt_name = pt_name
|
10 |
self.en_name = en_name
|
@@ -14,12 +16,15 @@ class Timer():
|
|
14 |
self.portuguese = False
|
15 |
else:
|
16 |
raise EnvironmentError
|
17 |
-
if not Timer.
|
18 |
if self.portuguese:
|
19 |
-
Timer.
|
|
|
20 |
else:
|
21 |
-
Timer.
|
|
|
22 |
self.display = Timer.expander.empty()
|
|
|
23 |
|
24 |
def __enter__(self):
|
25 |
if self.portuguese:
|
@@ -59,6 +64,8 @@ class Timer():
|
|
59 |
|
60 |
def reset():
|
61 |
Timer.total = 0
|
|
|
|
|
62 |
Timer.expander = None
|
63 |
|
64 |
def show_total():
|
|
|
4 |
|
5 |
class Timer():
|
6 |
total = 0
|
7 |
+
place_holder = None
|
8 |
expander = None
|
9 |
+
timer_list = []
|
10 |
def __init__(self, pt_name, en_name):
|
11 |
self.pt_name = pt_name
|
12 |
self.en_name = en_name
|
|
|
16 |
self.portuguese = False
|
17 |
else:
|
18 |
raise EnvironmentError
|
19 |
+
if not Timer.place_holder:
|
20 |
if self.portuguese:
|
21 |
+
Timer.place_holder = st.empty()
|
22 |
+
Timer.expander = place_holder.expander('Ver progresso')
|
23 |
else:
|
24 |
+
Timer.place_holder = st.empty()
|
25 |
+
Timer.expander = place_holder.expander('See progress')
|
26 |
self.display = Timer.expander.empty()
|
27 |
+
Timer.timer_list.append(self)
|
28 |
|
29 |
def __enter__(self):
|
30 |
if self.portuguese:
|
|
|
64 |
|
65 |
def reset():
|
66 |
Timer.total = 0
|
67 |
+
Timer.place_holder.empty()
|
68 |
+
Timer.place_holder = None
|
69 |
Timer.expander = None
|
70 |
|
71 |
def show_total():
|