Skip to content

Commit a5c240c

Browse files
committed
DOC update progressbar docstring
1 parent dfeda06 commit a5c240c

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

voxelwise_tutorials/progress_bar.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@
33

44

55
def bar(iterable, title='', use_it=True):
6-
"""simple API for progress_bar.
6+
"""Simple API for progress_bar.
77
8-
Example
9-
-------
8+
Parameters
9+
----------
10+
iterable : iterable
11+
Iterable that will make the progress bar progress.
12+
title : str
13+
Message to include at end of progress bar.
14+
use_it : bool
15+
If False, return the iterable unchanged, and does not show a progress
16+
bar.
17+
18+
Examples
19+
--------
1020
>>> import time
21+
>>> from voxelwise_tutorials.progress_bar import bar
1122
>>> for ii in bar(range(10)):
1223
>>> time.sleep(0.5)
1324
"""
@@ -18,7 +29,7 @@ def bar(iterable, title='', use_it=True):
1829

1930

2031
class ProgressBar():
21-
"""Class for generating a command-line progressbar.
32+
"""Generate a command-line progress bar.
2233
2334
Parameters
2435
----------
@@ -40,9 +51,10 @@ class ProgressBar():
4051
increment the progress bar very often. This provides the user with
4152
feedback that the progress has not stalled.
4253
43-
Example
44-
-------
54+
Examples
55+
--------
4556
>>> import time
57+
>>> from voxelwise_tutorials.progress_bar import ProgressBar
4658
>>> for ii in ProgressBar(title="La barre", max_value=10)(range(10)):
4759
>>> time.sleep(0.5)
4860
"""
@@ -133,6 +145,7 @@ def update_with_increment_value(self, increment_value, title=None):
133145
self.update(self.cur_value, title)
134146

135147
def close(self):
148+
"""Close the progress bar."""
136149
if not self.closed:
137150
sys.stdout.write('\n')
138151
sys.stdout.flush()

0 commit comments

Comments
 (0)