mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-30 19:21:17 +00:00
Merge pull request #898 from ThomasWaldmann/1.0-maint
reproducible doc for ProgressIndicator*
This commit is contained in:
commit
0a253edcfd
1 changed files with 6 additions and 2 deletions
|
@ -974,7 +974,7 @@ def yes(msg=None, false_msg=None, true_msg=None, default_msg=None,
|
||||||
|
|
||||||
|
|
||||||
class ProgressIndicatorPercent:
|
class ProgressIndicatorPercent:
|
||||||
def __init__(self, total, step=5, start=0, same_line=False, msg="%3.0f%%", file=sys.stderr):
|
def __init__(self, total, step=5, start=0, same_line=False, msg="%3.0f%%", file=None):
|
||||||
"""
|
"""
|
||||||
Percentage-based progress indicator
|
Percentage-based progress indicator
|
||||||
|
|
||||||
|
@ -989,6 +989,8 @@ def __init__(self, total, step=5, start=0, same_line=False, msg="%3.0f%%", file=
|
||||||
self.total = total
|
self.total = total
|
||||||
self.trigger_at = start # output next percentage value when reaching (at least) this
|
self.trigger_at = start # output next percentage value when reaching (at least) this
|
||||||
self.step = step
|
self.step = step
|
||||||
|
if file is None:
|
||||||
|
file = sys.stderr
|
||||||
self.file = file
|
self.file = file
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
self.same_line = same_line
|
self.same_line = same_line
|
||||||
|
@ -1016,7 +1018,7 @@ def finish(self):
|
||||||
|
|
||||||
|
|
||||||
class ProgressIndicatorEndless:
|
class ProgressIndicatorEndless:
|
||||||
def __init__(self, step=10, file=sys.stderr):
|
def __init__(self, step=10, file=None):
|
||||||
"""
|
"""
|
||||||
Progress indicator (long row of dots)
|
Progress indicator (long row of dots)
|
||||||
|
|
||||||
|
@ -1026,6 +1028,8 @@ def __init__(self, step=10, file=sys.stderr):
|
||||||
self.counter = 0 # call counter
|
self.counter = 0 # call counter
|
||||||
self.triggered = 0 # increases 1 per trigger event
|
self.triggered = 0 # increases 1 per trigger event
|
||||||
self.step = step # trigger every <step> calls
|
self.step = step # trigger every <step> calls
|
||||||
|
if file is None:
|
||||||
|
file = sys.stderr
|
||||||
self.file = file
|
self.file = file
|
||||||
|
|
||||||
def progress(self):
|
def progress(self):
|
||||||
|
|
Loading…
Reference in a new issue