FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-progressbar/tests/test_custom_widgets.py at develop · KarrLab/python-progressbar · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
KarrLab
/
python-progressbar
Public
forked from
wolph/python-progressbar
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-progressbar
/
tests
/
test_custom_widgets.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (49 loc) · 1.52 KB
Breadcrumbs
python-progressbar
/
tests
/
test_custom_widgets.py
Copy path
File metadata and controls
59 lines (49 loc) · 1.52 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
51
52
53
54
55
56
57
58
59
import
time
import
progressbar
class
CrazyFileTransferSpeed
(
progressbar
.
FileTransferSpeed
):
"It's bigger between 45 and 80 percent"
def
update
(
self
,
pbar
):
if
45
<
pbar
.
percentage
()
<
80
:
return
'Bigger Now '
+
progressbar
.
FileTransferSpeed
.
update
(
self
,
pbar
)
else
:
return
progressbar
.
FileTransferSpeed
.
update
(
self
,
pbar
)
def
test_crazy_file_transfer_speed_widget
():
widgets
=
[
# CrazyFileTransferSpeed(),
' <<<'
,
progressbar
.
Bar
(),
'>>> '
,
progressbar
.
Percentage
(),
' '
,
progressbar
.
ETA
(),
]
p
=
progressbar
.
ProgressBar
(
widgets
=
widgets
,
max_value
=
1000
)
# maybe do something
p
.
start
()
for
i
in
range
(
0
,
200
,
5
):
# do something
time
.
sleep
(
0.1
)
p
.
update
(
i
+
1
)
p
.
finish
()
def
test_dynamic_message_widget
():
widgets
=
[
' ['
,
progressbar
.
Timer
(),
'] '
,
progressbar
.
Bar
(),
' ('
,
progressbar
.
ETA
(),
') '
,
progressbar
.
DynamicMessage
(
'loss'
),
progressbar
.
DynamicMessage
(
'text'
),
progressbar
.
DynamicMessage
(
'error'
,
precision
=
None
),
]
p
=
progressbar
.
ProgressBar
(
widgets
=
widgets
,
max_value
=
1000
)
p
.
start
()
for
i
in
range
(
0
,
200
,
5
):
time
.
sleep
(
0.1
)
p
.
update
(
i
+
1
,
loss
=
.5
,
text
=
'spam'
,
error
=
1
)
i
+=
1
p
.
update
(
i
,
text
=
None
)
i
+=
1
p
.
update
(
i
,
text
=
False
)
i
+=
1
p
.
update
(
i
,
text
=
True
,
error
=
'a'
)
p
.
finish
()
Back
|
FazBrowse Home
|
New Git URL